Results 1 to 3 of 3

Thread: Insert record script

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2002
    Posts
    17

    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

  2. #2
    Hyperactive Member
    Join Date
    Dec 2001
    Location
    Dublin, Ireland
    Posts
    262
    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.

  3. #3
    New Member
    Join Date
    Jun 2002
    Posts
    12

    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
  •  



Click Here to Expand Forum to Full Width