Results 1 to 2 of 2

Thread: Addnew records to SQL ver6.5

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2000
    Posts
    19
    How to construct the command line if i would like my VB program to addnew record to SQL? Can refer to my prior question on 'Where is the problem' for a clearer idea.

    Thanks for the effort taken to help me.

    God bless
    Nigel
    [email protected]

  2. #2
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696

    Smile

    It goes something like this

    Code:
    strSql = "INSERT INTO tbltest(string1,date1,number1)" & _
      " VALUES('" & strString1 & "','" & txtDate1.value & "'," & iNumber1 & ")"
    
    db.execute strSql
    This Example lets you Insert 3 specific fields, But you can leave out the (string1,date1,number1). If you leave this out you have to enter all fields and set The ones you don't want to NULL.

    Code:
    strSql = "INSERT INTO tbltest" & _
      " VALUES('" & strString1 & "','" & txtDate1.value & "'," & iNumber1 & ",NULL,NULL)"
    
    db.execute strSql
    Hope This Helps

    Ian
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

Posting Permissions

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



Click Here to Expand Forum to Full Width