Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    insert in DB using for loop

    how to insert in db using for loop?
    please send complete code

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,074
    Thanks
    0
    Thanked 256 Times in 252 Posts
    could you be more specific of what you are trying to accomplish?
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts
    instead of using (while rs.eof) i want to use for loop
    i want coplete example starting from (adodb .connection) to last of the code.
    Last edited by ahmedsoliman; 08-08-2002 at 12:17 PM.

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm not sure what you're trying to do, but here you go (Access 200 db):

    Code:
    Set Conn = Server.CreateObject("ADODB.Connection")
    sConnString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
    Mid(Server.MapPath("\"), 1, InStrRev(Server.MapPath("\"),"\")-1) & _
    "\database\databasename.mdb;" & _
    "Persist Security Info=False;"
    Conn.Open sConnString
    
    For i = 1 to 12
    InsertString = "INSERT INTO table_name (myvariable) VALUES ('" & i & "')"
    Conn.Execute(InsertString)
    Next
    
    Conn.Close
    Set Conn = Nothing
    That would insert 1-12 into a field called "myvariable"...
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thank you


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •