First of all, excuse me for my english. I'll try to explain the problem the 
better I can.

I have an application in c# (.NET) where I work with Firebird databases, and 
firebird connections. All works perfect, but I also work with threading, and 
I have a problem when my program try to open a connection, when a thread is 
trying too.

I always use this code to access to database:

FbConnection c = getExistentConnection();
(where getExistentConnection() returns a connection yet created).

FbCommand s = c.CreateCommand();

String query = "SELECT ...";

s.CommandText = query;

if (s.Connection.State == ConnectionState.Closed)
    s.Connection.Open();

FbDataReader rdr = s.ExecuteReader();

I think the problem happens when the main program open a connection, and 
it's ready to execute the ExecuteReader, and simultaneously the thread open 
and close de same connection, so the main program try to ExecuteReader, but 
it's not possible. The error is always "the connection must be valid and 
open"

My question is ...

Is there any way to get a persistent access to the database in order to 
avoid "the connection must be valid and open" error?

Thank you for your attention,
Alberto Parrilla (Spain) 
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to