I have defined a ConnectionString in web.config
succesfully I have started using it for linking SqlDataSource to
controls (TextBox, Grid etc). I want to use that same connection to
excecute FbCommand. I need it for executing StoredProcedures. how to do
that?
I can connect and execute FB stored procedures with following code
using (FbConnection conn = new FbConnection("data
source=localhost;initial catalog=C:\\Program
Files\\Firebird\\examples\\EMPLOYEE.GDB;user id=SYSDBA;password=masterkey"))
{
conn.Open();
using (FbCommand cmd = conn.CreateCommand())
{
cmd.CommandText = "execute procedure
ADD_EMP_PROJ(@a, @b);"; ;
cmd.Parameters.Add("@a", FbDbType.Integer).Value = 2;
cmd.Parameters.Add("@b", FbDbType.VarChar).Value =
"DGPII";
cmd.ExecuteNonQuery();
}
conn.Close();
}
but this opens and closes the connection each time. I want to use
already existing connection globally across application (ASP.net
webforms). I am new to Visual Studio and .NET and sorry for asking basic
question, but if I write using (ConnectionString) then this
ConnectionString is unknown, despite that on same form it is used behind
a SqlDataSource control....
how to do this in a better way?
------------------------------------------------------------------------------
Learn Windows Azure Live! Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for
developers. It will provide a great way to learn Windows Azure and what it
provides. You can attend the event by watching it streamed LIVE online.
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider