|
-
Jun 12th, 2002, 05:12 PM
#1
Thread Starter
Junior Member
Insert record script
I am tring to use an inser sql to update the database.
insertSQL = "INSERT INTO Supportcall(ID,Contact,Description)" & " VALUES(txtcallnumber.text,txtcallcontact.text,txtcalldescription.text)"
where txtcallnumber.text are cells in the form.
When I run the app, the exception message is No Value Given for one or more parameters.
The access 2k table only has the 3 fields outlined above
If I 'manually' insert the record it works fine.
insertSQL = "INSERT INTO Supportcall(ID,Contact,Description)" & " VALUES('2','Fred Atkins','This is the description')"
Furthermore, I have a declared the fields as
dr = dssupport.Tables("Supportcall").NewRow()
dr("ID") = txtcallnumber.Text
dr("Description") = txtcalldescription.Text
dr("Contact") = txtcallcontact.Text
-
Jun 12th, 2002, 08:55 PM
#2
Hyperactive Member
It's a bit unclear what exactly you are using to send the update to the database. If you ran that sql statement on the command object it should execute fine. If you are trying to use a DataAdapter and Dataset/DataRow then you have to set the InsertCommand, UpdateCommand, DeleteCommand etc. on the DataAdapter. Your error suggests this as using a DataRow to update data requires an UpdateCommand linking source columns between the DataRow in the DataSet and the parameters in your UpdateCommand. The statement where you specify values works becuase it has no parameters and doesn't go looking for them in the DataRow.
-
Jun 15th, 2002, 08:44 PM
#3
New Member
Heres what you need i think
insertSQL = "INSERT INTO Supportcall(ID,Contact,Description)" & " VALUES(txtcallnumber.text,txtcallcontact.text,txtcalldescription.text)"
is what you have... try this instread
insertSQL = "INSERT INTO Supportcall(ID,Contact,Description)" & " VALUES("+txtcallnumber.text+","+txtcallcontact.text+","+txtcalldescription.text+")"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|