ok here it is i am trying to insert all of the data from a form into a SQL server database.
i am using visual basic 6
here is the statement i am trying to do
cmdemployee.CommandText = "INSERT INTO employees ('fname,midname,lname,address,ssn,city,state,zip,extention,employeeid,
ethnicity,sex,religion,hiredate,dateofbirth') Values ('" & strfname & ", " & strmidname & ", " & strlname & ", " & straddress & ", " & strssn & ", " & strcity & ", " & cbbstate & ", " & strzip & ", " & zipext & ", " & rstotal & ", " & strhphonearea & ", " & strwphonearea & ", " & strhphone & ", " & strwphone & ", " & email & ", " & stremploymentstat & ", " & strethnic & ", " & strsex & ", " & strrelig & ", " & strhiredate & ", " & birthdate & "')"
ok now i have tried this about a million ways and this is how i have it right now.
the error i am getting is
"invalid object name 'employees'"
now i have another part of the form that is pulling information from this database and same table so it isn't in the connection because i am using the same connection string.
also as you notice i have single quotes areound the columns and the values this is because when i apss a variable into the values column i have to use the syntax
commandname.commandtext = "Insert into tablename ('columns) VALUES ('" & variable1 & "')"
now if i have the single quote in just the values list visual basic thinks that i have one more variable than i have columns.
if anyone can help me with this one i would greatly appreciate it
please email me with your suggestions
0 · ·