Hi all
Using VS2005 , FB1.5.4 and FB.Net 2.1!
I have a procedure to verify if a SP exist in database, code looks like:
public string ProcedureExist(string fbcs, string procedurename)
{
string res = "NO_PROCEDURE";
try
{
using (FirebirdSql.Data.FirebirdClient.FbConnection fbc =
new FirebirdSql.Data.FirebirdClient.FbConnection(fbcs))
{
fbc.Open();
FirebirdSql.Data.FirebirdClient.FbCommand fbcommand =
new FirebirdSql.Data.FirebirdClient.FbCommand();
fbcommand.CommandText = "select rdb$procedure_name from
RDB$PROCEDURES where (UPPER(RDB$PROCEDURE_NAME) = UPPER(@pn))";
fbcommand.Connection = fbc;
fbcommand.CommandType = System.Data.CommandType.Text;
fbcommand.Parameters.AddWithValue("@pn", procedurename);
res = fbcommand.ExecuteScalar().ToString().Trim();
if (res == null)
{
res = "NO_PROCEDURE";
}
}
}
catch (FirebirdSql.Data.FirebirdClient.FbException ex)
{
MessageBox.Show(ex.Message);
}
catch (Exception except)
{
MessageBox.Show(except.Message);
}
This procedure work ok if SP exist in database. If SP not exist then is
generated exception on line : res =
fbcommand.ExecuteScalar().ToString().Trim(); and is catched as "except". If
I run the command I get "null" in IBExpert, but ExecuteScalar generate
error.
I think I'll use GetSchema instead of this!
Regards,
Paul
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider