Deleting all records produces error

  • Hi

    I've created a dataAdapter with a SelectCommand,

    a DeleteCommand and an InsertCommand.

    The DeleteCommand should delete all the records in the table and the InsertCommand add new records.

    When I do dataAdapter.Update I receive

    An unhandled exception error.

    If I remove the DeleteCommand everything works fine.

     

    Any ideas ?

  • could be permissions, referential integrity

    Are you using a stored proc for the delete command or dynamic sql?

    (number of output parameters match?)

  • I'm using the Data Adapter Configuration Wizard.

    The delete is from the DeleteCommand of the dataAdapter.Update.

    How do I know the order of events in the dataAdapter.Update command?

  • for update you need to specify the update command also

    see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatacommondataadapterclassupdatetopic.asp

    for the microsoft help on dataadapter.update

  • David,

    Place the code in a try... catch block and extract the error message

    e.g

    try{

       YourStuff();

    catch(Exception ex){

       MessageBox.Show(ex.Message);

    }

    This will give you a better idea of what is happening.

    regards

    Shaun

    Quis custodiet ipsos custodes.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply