Hi,
I've implemented: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=12594&HighLight=1, and up untill now it worked perfectly. Today was the first time I used it for stored procedures and then it won't work.
When I manually open the connection with my custom method GetOpenSqlConnection on the DataAdapter before calling the stored procedure it works, but otherwise it won't. Doesn't a call to a SP come through OpenConnection() on the Adapter?
Non working code:
AppRoleDataAccessAdapter adapter = new AppRoleDataAccessAdapter();
dt = RetrievalProcedures.NsIfrjobsManager(userId, adapter);
working code:
AppRoleDataAccessAdapter adapter = new AppRoleDataAccessAdapter();
// Manually open:
adapter.GetOpenSqlConnection();
dt = RetrievalProcedures.NsIfrjobsManager(userId, adapter);
Custom method:
public SqlConnection GetOpenSqlConnection()
{
var connection = this.GetActiveConnection() as SqlConnection;
if (connection.State == ConnectionState.Closed)
{
this.OpenConnection();
}
return connection;
}
Is there a nicer way to achieve this?
Thanks