Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looping... can help to check for it?

Status
Not open for further replies.

choohean

Technical User
Jan 15, 2002
57
MY
I try to do something looping so that I can get a few of records to store in my database with multirow table...

Can anyone here please help check for it!?

This is my code:

dim number, counter

counter = 0

number=Request.Form("count")

Do until counter = number
counter = counter + 1

yr = Request.Form("yr_"&counter&"")

Response.Write(yr)

Loop
 
The following code will insert rows containing one field into your database.


dim conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.open "DSN=myDB"

dim number, counter, sql

counter = 0

number=Request.Form("count")

Do until counter = number
counter = counter + 1

sql = "INSERT INTO myTable (myYear) VALUES '" & Request.Form("yr_"&counter&"") & "'"
conn.Execute sql

Loop

conn.close : set conn = nothing Mighty :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top