input box

A

amatuer

Hi, I have an input box that sends data over to the next page. This
input box was in a loop, there creating data looking like this: 2, 0,
0, 3, 0, 4, 0, 22, 0, 0, 0

How do i break the data up in such a way that i can populate it into my
db while running through a recordset?

Any help would be highly appreciated. Thanx
 
E

Evertjan.

amatuer wrote on 01 nov 2006 in microsoft.public.inetserver.asp.general:
Hi, I have an input box that sends data over to the next page. This
input box was in a loop, there creating data looking like this: 2, 0,
0, 3, 0, 4, 0, 22, 0, 0, 0

How do i break the data up in such a way that i can populate it into my
db while running through a recordset?

Any help would be highly appreciated. Thanx

I think we need relevant code, what database and database engine you use.

Why a recordset?
 
A

Arnost Sobota

Evertjan. a écrit :
amatuer wrote on 01 nov 2006 in microsoft.public.inetserver.asp.general:


I think we need relevant code, what database and database engine you use.

Why a recordset?

First you must split your string into an array using the Split function:

MyArray = Split(MyString,", ")

Then you can loop through the values and do what you need with them:

For Each MyValue In MyArray
sql = "INSERT INTO MyTable(MyField,OtherField1,OtherField2,...)
VALUES(MyValue,OtherValue1,OtherValue2,...);"
RS.Open sql
Next

(The example above assuming you need to add records to a database table)
 
A

amatuer

I split the string. bt nw im getn this error:

Provider error '80040e1b'

Identity cannot be determined for newly inserted rows.

/reenval/RInset2.asp, line 40

<% If Fout <> 1 Then %>
<% sql="Select * FROM R_Reenval"
set rstMainU = CreateObject("ADODB.Recordset")
rstMainU.Open sql, _
"Provider=SQLOLEDB.1;Persist Security Info=False;User
ID=sa;password=admin@sql;Initial Catalog=GIS;Data
Source=172.16.4.180",1,4
rstMainU.addnew
i = 0
j = 0
k = 0
While not rstMain.eof
Silo = split(Request.Form("Silo"),",")
line 40 rstMainU("Naam") = Silo(j)
rstMainU("Datum") = NewDatum
rstMainU("Jaar") = request.form("Jaar")
rstMainU("Maand") = request.form("Maand")
rstMainU("Dag") = request.form("Dag")
Reen = split(Request.Form("Reenval"),",")
rstMainU("Reenval_Silo") = Reen(i)
rstMainU("Sek_ID") = session("ID")
If telreg <> 0 Then
streek = split(Request.Form("Region"),",")
rstMainU("Region") = streek(k)
Else
rstMainU("Region") = ""
End If
rstMainU.updatebatch
i = i + 1
j = j + 1
k = k + 1
rstMain.Movenext
wend%>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,138
Messages
2,570,802
Members
47,348
Latest member
nethues

Latest Threads

Top