#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Posts
    5
    Rep Power
    0

    Troubles with DataAdapter deleting twice with .NET Provider 1.6 RC2


    Hi All,

    Im trying to delete two rows in a DataTable using the same DataAdapter. The first Row always is well deleted but when I try to delete
    the second row an exception is raised in da_Adapter.Update() that says:
    <<A first chance exception of type 'FirebirdSql.Data.Common.IscException' occurred in firebirdsql.data.firebird.dll>>

    Here is the code:

    FbDataAdapter da_Modelos = new FbDataAdapter();
    da_Models.DeleteCommand = new FbCommand("DELETE FROM MODELS WHERE IDMODEL = @A", theConnection);
    p = new FbParameter();
    p.ParameterName = "@A";
    p.FbDbType = FbDbType.Integer;
    p.Precision = 4;
    p.SourceColumn = "IDMODELO";
    p.Direction = ParameterDirection.Input;
    p.IsNullable = false;
    da_Models.DeleteCommand.Parameters.Add( p );
    [...]
    dt_table.Rows[position].Delete( );
    [...]
    theConnection.Open();
    da_Adapter.Update( dt_table );
    theConnection.Close();
    [...]
    dt_table.Rows[position].Delete( );
    [...]
    theConnection.Open();
    da_Adapter.Update( dt_table );
    theConnection.Close();

    // where dt_table has been filled with "SELECT * FROM MODELS"

    It does not happen if I renew the delete command. The problem is that I cant renew the delete command in my final code...
    Can DadaAdapters be reused for several updates?... if they can be used... What am I doing wrong?

    Im using Firebird .NET Provider 1.6 RC2

    Thank you in advance
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Posts
    5
    Rep Power
    0
    Hi again,
    More information... Im getting the exception when I open the conection before the second Update. CommandPlan variable in the delete command object changes its value to:

    - deleteCommand {FirebirdSql.Data.Firebird.FbCommand} FirebirdSql.Data.Firebird.FbCommand
    + System.ComponentModel.Component {FirebirdSql.Data.Firebird.FbCommand} System.ComponentModel.Component
    ActiveTransaction <undefined value> FirebirdSql.Data.Firebird.FbTransaction
    actualCommand 0 int
    CommandPlan <error: an exception of type: {FirebirdSql.Data.Common.IscException} occurred> string

    After that... when Update() is executed... the exception is raised

    Thanks again
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    13
    Rep Power
    0
    Hello:

    Originally Posted by paul ankho

    It does not happen if I renew the delete command. The problem is that I cant renew the delete command in my final code...
    Can DadaAdapters be reused for several updates?... if they can be used... What am I doing wrong?

    Im using Firebird .NET Provider 1.6 RC2

    Thank you in advance
    Please can you send this to the .NET provider developement list,
    you can subscribe to it here:

    http://lists.sourceforge.net/lists/l...d-net-provider

IMN logo majestic logo threadwatch logo seochat tools logo