Hello:
>
> Are Stored Procedures with input parameters implemented?
> If so, I's apprecciate some sample code.
>
Here is a little sample code:
FbConnection conn = new FbConnection();
FbTransaction txn;
try
{
conn.ConnectionString = "Database=C:\PROGRAM
FILES\FIREBIRD\EXAMPLES\EMPLOYEE.GDB;User=SYSDBA;Password=masterkey;Server=localhost;Port=3050;Dialect=3;Charset=NONE;Role=;Connection
Lifetime=15;Pooling=true";
conn.Open();
txn = (FbTransaction)conn.BeginTransaction();
FbCommand cmd = new FbCommand("EXECUTE PROCEDURE GET_EMP_PROJ(?)",
conn, txn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@EMP_NO", 2);
cmd.Parameters.Add("@PROJ_ID", "").Direction = ParameterDirection.Output;
int ret = cmd.ExecuteNonQuery();
conn.Close();
}
catch(Exception ex)
{
Console.WriteLine("Exception message: {0}", ex.Message);
conn.Close();
}
--
Un saludo
Carlos Guzmán Álvarez
Vigo-España
"No tengo dones especiales.Sólo soy apasionadamente curioso"
Albert Einstein, científico.
|