Hi,
I'm working with Visual studio 2008, C#, firebird 2.1 and .net provider
2.6.5.0.
I have a problem with FbDataAdapter. Using the dataadapter to update the
records in my datatable, I get an error: "invalid transaction handle".
The problem never shows up when I use the command for the 1st time.
>From the 2nd time and next, I ALWAYS receive that error.
To keep it simple, here is the code I'm struggling with
(I have a very simple sample project if needed)
What am I doing wrong? This works perfectly with Sql Server express or
server 2008.
----------------------------------------------------------
FbConnection cn = new FbConnection(ConnectionString);
cn.Open();
FbTransaction tr = cn.BeginTransaction(IsolationLevel.ReadCommitted);
try
{
da1.SelectCommand.Connection = cn;
da1.SelectCommand.Transaction = tr;
da1.Update(ds);
tr.Commit();
MessageBox.Show("OK!","", MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
catch (Exception ex)
{
tr.Rollback();
MessageBox.Show("ERROR\r\n" + ex.Message, "", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
cn.Close();
tr.Dispose();
----------------------------------------------------------
where...
da1 is a FbDataAdapter
ds is my dataset containing only one datatable
the stack trace is:
in FirebirdSql.Data.FirebirdClient.FbDataAdapter.Update(DataRow[]
dataRows, DataTableMapping tableMapping) in
C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\FirebirdClient\FbDataAdapter.cs:riga
455
in System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable
dataTable, DataTableMapping tableMapping)
in System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String
srcTable)
in System.Data.Common.DbDataAdapter.Update(DataSet dataSet)
in DataSetFireBird.Form1.button1_Click(Object sender, EventArgs e) in
C:\Documents and
Settings\Joss\Documenti\Comelit\_Codice\DataSetFireBird\DataSetFireBird\Form1.cs:riga
63
I even tried the workaround and the solution proposed here
http://web.archiveorange.com/archive/v/hKdPdHipY8BuO39xw2ag
but, when it's about the workaround, it doesn't work.
On the other hand, I don't get how to apply the fix proposed by Jiri.
The last but not least, the error NEVER shows up when using the server mode,
but is ALWAYS shown when using the embedded version. The difference is,
obviously, in the connection string to the database.
here are the two connection strings
SERVER: private String ConnectionString =
@"Server=localhost;User=SYSDBA;Password=masterkey;Database=C:\Documents and
Settings\Joss\Documenti\Test\db\test.FDB";
EMBEDDED: private String ConnectionString =
@"User=SYSDBA;Password=masterkey;Database=C:\Documents and
Settings\Joss\Documenti\Test\db\test.FDB;server
type=Embedded;charset=UTF8;";
In my environment is supposed to use the embedded version (it's a
redistributable application).
Thanks in advance
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider