Jump to content

loop in sql using ASP


nazar

Recommended Posts

maxcounter stands for how many times you want to repeat the query

set conn2=Server.CreateObject("ADODB.Connection")conn2.Provider="Microsoft.Jet.OLEDB.4.0"conn2.Open "Provider=SQLOLEDB; Data Source = ......"For i = 0 to maxcounter    sql = "INSERT INTO [I]naamtables [/I]VALUES ([I]'Values"'[/I])"    conn2.Execute(sql)Next

for your sql query you can use dynamical variables to change the queriefor example

sql2 = "INSERT INTO Simulatie_auteur VALUES ('"&request.form("titel") & "', '" & memberarray(i) & "')"

the titel stays the same, but the memberarray(i) changes as long maxcounter hasn't been reachedi hope this wil help you on your way :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...