N
Nak
Hi there,
I have a little question regarding the "INSERT INTO" command. Lets say
I have a table with 3 columns, the first of which is an autonumber and the
second 2 are the first and last names of a person. How do I insert into the
table but have the autonumber generated automatically?
For example
cCmdCommand.CommandText = String.Format("INSERT INTO contacts(first,last) "
& _
"values('{0}','{1}')", _
iContact.ToParamArray)
This is causing me to recieve a syntax error. The iContact objects
method "ToParamArray" simply creates a 1 dimensional object array a fills it
with strings, this seems to contain the correct data but still I am
recieving a syntax error
"Error - Syntax error in INSERT INTO statement."
Should I be including a parameter in there to have an autonumber
generated for me? or do I have to specify the autonumber myself? Thanks in
advance.
cCmdCommand.CommandText = String.Format("INSERT INTO contacts(id,first,last)
" & _
"values('{0}','{1}','{2}')", _
"generate an autonumber for me!!",iContact.First,iContact.Last) ????
Nick.
--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
"No matter. Whatever the outcome, you are changed."
Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
I have a little question regarding the "INSERT INTO" command. Lets say
I have a table with 3 columns, the first of which is an autonumber and the
second 2 are the first and last names of a person. How do I insert into the
table but have the autonumber generated automatically?
For example
cCmdCommand.CommandText = String.Format("INSERT INTO contacts(first,last) "
& _
"values('{0}','{1}')", _
iContact.ToParamArray)
This is causing me to recieve a syntax error. The iContact objects
method "ToParamArray" simply creates a 1 dimensional object array a fills it
with strings, this seems to contain the correct data but still I am
recieving a syntax error
"Error - Syntax error in INSERT INTO statement."
Should I be including a parameter in there to have an autonumber
generated for me? or do I have to specify the autonumber myself? Thanks in
advance.
cCmdCommand.CommandText = String.Format("INSERT INTO contacts(id,first,last)
" & _
"values('{0}','{1}','{2}')", _
"generate an autonumber for me!!",iContact.First,iContact.Last) ????
Nick.
--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
"No matter. Whatever the outcome, you are changed."
Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\