|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
inserting with an auto incremented field?
var SQLString = "INSERT INTO table VALUES( '' ,'" + Request.Form("name") + "','"
+ strAlpha + "','', '" + Request.Form("email") + "', '" + Request.Form("userid") + "')"; dbConnection.Execute(SQLString); This is jscript inserting into access2000. My table looks like this: id (autonumber) name date userid Its the first field that causing my problems, I get a data type mismatch error. How do I insert with an auto incremented field?! |
|
#2
|
||||
|
||||
|
You don't need to insert anything into the auto incremented field -- it'll automatically enter whatever the next number needs to be. Your query isn't specifying which fields your values are meant to go into, so it's just starting at the beginning, trying to stick your 'name' value into your id field -- hence the type mismatch.
Just specify your destination fields: INSERT INTO table (name,email,userid) VALUES (namevalue,emailvalue,useridvalue) and all should be fine. |
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > inserting with an auto incremented field? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|