mysql with auto_increment Insert problem.
So I have an auto increment column (As my first column), but I don't know how to write the insert command because of it.
I tried like that:
objConn.Execute("INSERT INTO TABLE VALUES ('','SecondElement')")
But it didn't work
I tried to write the right number, meanning
objConn.Execute("INSERT INTO TABLE VALUES ('1','SecondElement')")
and it work, but I want a general command, because I don't want a check each time, what should be the next number, anyone knows how to do it?
Thanks in advanced, Oz.
pass the field names that you are inserting. let's say your table looks like this
id (the auto-increment field)
then your sql becomes
insert into myTable (name, address) Values('russell', '123 main street')
I have 20 fields, so I want a do it diffrentely, do you know how to do it?
you don't pass anything for the auto number field, mysql takes care of that. your insert sql statement must be in that format to work correctly. just don't put anything in there for the auto number field liked russell mentioned
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)