PDA

Click to See Complete Forum and Search --> : Addnew records to SQL ver6.5


nigel_chong98
May 15th, 2000, 12:23 PM
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.

Ianpbaker
May 15th, 2000, 03:11 PM
It goes something like this


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.


strSql = "INSERT INTO tbltest" & _
" VALUES('" & strString1 & "','" & txtDate1.value & "'," & iNumber1 & ",NULL,NULL)"

db.execute strSql


Hope This Helps

Ian