Update SQL using sqldataadapter

Last post 06-02-2009 11:31 PM by Thomas Sun – MSFT. 1 replies.

Sort Posts:

  • Update SQL using sqldataadapter

    05-28-2009, 9:11 AM
    • Member
      112 point Member
    • Dazza22
    • Member since 04-28-2006, 12:26 PM
    • Manchester, England
    • Posts 64
    I am trying to write a system which allows users to enter thier details in a form which is then submitted to the database which i have managed to do so far but now i want to be able to let the update the details that they have previously entered in the same form. I have a dataadapter which fills a dataset with thier previously entered details which i then use the following example statements to fill my textboxes with thier previously entered details

    TextQ2.Text = DsEntry1.Tables(0).Rows(0).Item("q2_text")

     this works fine so far i want to be able to let then update thier details then submit them directly back to the database but no matter what i try i dont seem to be able to do this

    This is my update statement within the sqldataadapter

    UPDATE blueprint SET q1 = @q1, q2_text = @q2_text, q3 = @q3, q3_text = @q3_text, q4 = @q4, q4_text = @q4_text, q5 = @q5, q5_text = @q5_text WHERE empno = @empno

     any advice would be greatly appreciated as i have not created an update with a sqldataadapter before

    Thanks

    Knowledge is not power it is a gift so lets share our gifts. Enjoy It
  • Re: Update SQL using sqldataadapter

    06-02-2009, 11:31 PM
    Answer

    Hi,

    You can use the CommandBuilder object to automatically generate the DeleteCommand, the InsertCommand, and the UpdateCommand properties of the DataAdapter.

    You also can manually create UpdateCommand for DataAdapter.

    For more information, see http://support.microsoft.com/kb/308055

     

    I look forward to receiving your test results.

    Thomas Sun
    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
Page 1 of 1 (2 items)