Subject | Re: [firebird-support] Firebird stored procedure |
---|---|
Author | Dean Harding |
Post date | 2007-12-14T04:02:55Z |
Lin XG wrote:
Add, you use AddWithValue, as in:
FB_DbCommand.Parameters.AddWithValue("@xfer_condition", XFER_CONDITION)
Because passing the actual value to the Add() method can cause trouble
with certain parameter type combinations.
Also, if you want to pass numeric types as NULL, you can pass
DbNull.Value in as the parameter value.
Dean.
> I'm using VB.NET. Here is what my code looks like.Looks like it'll work fine just as is. I would suggest that instead of
>
> XFER_CONDITION = "A string that can also be NULL"
>
> FB_DbCommand = New FbCommand("MY_QUERY",
> FB_DbConnection)
> FB_DbCommand.CommandType = CommandType.StoredProcedure
> FB_DbCommand.Parameters.Add("@xfer_condition",
> XFER_CONDITION)
>
> FB_DbCommand.ExecuteNonQuery()
>
> It works fine but I am not how to deal with the
> possibility of my paramater being NULL.
Add, you use AddWithValue, as in:
FB_DbCommand.Parameters.AddWithValue("@xfer_condition", XFER_CONDITION)
Because passing the actual value to the Add() method can cause trouble
with certain parameter type combinations.
Also, if you want to pass numeric types as NULL, you can pass
DbNull.Value in as the parameter value.
Dean.