Explicitly setting Interger variable to NULL before passing to dat

G

Guest

I have a variable declared as integer which I populate based on the value on
a grid. This value can be NULL. However, I get an exception when I try to
save this value to the database even though the paramaeter has been declared
with a default of NULL in the stored procedure. Is there a way I can set an
integer value explicitly to NULL, something like
var = system.dbnull.value
 
J

Joanna Carter [TeamB]

"DUMMY Keyword in SQL Server 2000"
<[email protected]> a écrit dans le
message de news: (e-mail address removed)...

|I have a variable declared as integer which I populate based on the value
on
| a grid. This value can be NULL. However, I get an exception when I try to
| save this value to the database even though the paramaeter has been
declared
| with a default of NULL in the stored procedure. Is there a way I can set
an
| integer value explicitly to NULL, something like
| var = system.dbnull.value

If you are using C# 2.0, then you can use Nullable<int> for your variable,
also available as int? notation.

Joanna
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top