469,299 Members | 2,066 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,299 developers. It's quick & easy.

How to set parameter to null

Gav
Hi all,

Having a little problem with parameters, I need to set a parameter to null
but I'm getting errors that I don't understand.

The code:

SqlParameter prmItemNumber= mycom.Parameters.Add(new
SqlParameter("@ItemNumber",SqlDbType.VarChar, 10));
prmItemNumber.set_IsNullable(true);
prmItemNumber.Value= (Convert.DBNull);

The error:

On build I get the error,
'System.Data.SqlClient.SqlParameter.IsNullable.set ': cannot explicitly call
operator or accessor

Can anyone help me with this please?

Thanks
Gav
Jul 21 '05 #1
2 4712
Why don't you say:

prmItemNumber.IsNullable = true;

"Gav" <sp**@spam.com> wrote in message
news:OR**************@TK2MSFTNGP15.phx.gbl...
Hi all,

Having a little problem with parameters, I need to set a parameter to null
but I'm getting errors that I don't understand.

The code:

SqlParameter prmItemNumber= mycom.Parameters.Add(new
SqlParameter("@ItemNumber",SqlDbType.VarChar, 10));
prmItemNumber.set_IsNullable(true);
prmItemNumber.Value= (Convert.DBNull);

The error:

On build I get the error,
'System.Data.SqlClient.SqlParameter.IsNullable.set ': cannot explicitly
call operator or accessor

Can anyone help me with this please?

Thanks
Gav

Jul 21 '05 #2
Gav
seems to work

thank you so much for that much appretiated
Gav

"Marina" <so*****@nospam.com> wrote in message
news:eg*************@TK2MSFTNGP12.phx.gbl...
Why don't you say:

prmItemNumber.IsNullable = true;

"Gav" <sp**@spam.com> wrote in message
news:OR**************@TK2MSFTNGP15.phx.gbl...
Hi all,

Having a little problem with parameters, I need to set a parameter to
null but I'm getting errors that I don't understand.

The code:

SqlParameter prmItemNumber= mycom.Parameters.Add(new
SqlParameter("@ItemNumber",SqlDbType.VarChar, 10));
prmItemNumber.set_IsNullable(true);
prmItemNumber.Value= (Convert.DBNull);

The error:

On build I get the error,
'System.Data.SqlClient.SqlParameter.IsNullable.set ': cannot explicitly
call operator or accessor

Can anyone help me with this please?

Thanks
Gav


Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by js | last post: by
19 posts views Thread by George | last post: by
4 posts views Thread by =?Utf-8?B?UHVjY2E=?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.