From: Mark E. S. Jr. <ms...@sc...> - 2003-02-10 20:01:09
|
I'm working with a downloaded copy of Firebird (downloaded less than two weeks ago from sourceforge), on a WinXP box. I'm able to work with the server just fine, have imported a large amount of data, used the ODBC driver to import data from Access with success. However, I have not been able to get a driver working well in .NET either version 1.0 or 1.1. When using the FirebirdSql.Data.Firebird drivers, it usually works the first time, but after that, I get sometimes a SQL error with a code -104, and after that it starts just telling me "Error reading data from the connection" on the line where I call the DataAdapter.Fill function. I haven't seen somebody using a DataAdapter in the way that I am, so I'm wondering if its just a DataAdapter issue. Below you can see the example code I'm testing with. After I get the data I'm just piping out out to XML. string sSQL = "SELECT * FROM INVOICERECEIPT_HEADER WHERE POSTHEADID=8220;"; FbConnection conn = new FbConnection("Database=D:\Program Files\Firebird\data\test.gdb;User=test_user;Password=zipper;Dialect=3;Se rver=localhost;Role=authors"); FbCommand cmd = new FbCommand(sSQL, conn); cmd.CommandType = CommandType.Text; FbDataAdapter da = new FbDataAdapter(cmd); DataSet ds = new DataSet("InvoiceReceipt"); conn.Open(); FbTransaction trans = conn.BeginTransaction(); cmd.Transaction = trans; da.Fill(ds, 0, 0, "Header"); trans.Commit(); conn.Close(); Like I said, it seems to work the first time especially after a reboot, sometimes it will work a second time, but after that I get the SQL -104 error, and after that I just keep getting "Error reading data from the connection". Is there something I'm doing wrong? The only thing I had to add over the documentation in the help files is the Transaction code. It would not allow me to execute anything without first making a transaction. Thanks! Mark E. Scott Jr. ms...@sc... P.S. I was originally using the compiled DLL from the site, and have now downloaded the latest source from CVS and included it in my Visual Studio project so I could perhaps use the debugger and look through whats happening. Haven't had time to do that yet. |