dbnull value

  • Thread starter Thread starter NuB
  • Start date Start date
N

NuB

I have a grid on a winForm, where I can enter a date or leave it blank for
data entry. If I have a data field blank I get a DBNull value error, how can
I allow a blank date field in my grid be passed into the database without
getting a DBNull error?
 
NuB,

Does the underlying column in the database support null values? If it
doesn't, and you are trying to update the value with null, you will get an
error.

Or are you getting a different error? If so, what are the details?

Hope this helps.
 
Hi,

Does the column in the DB accept nulls?

It has to accept null.


cheers,
 
yes, the date colum supports NULL values.

I get the error "Cannot get value because its DBNull"
I get this on the first row that has no date entered. If the first row has a
date entered then I do not get this error until I hit a row that has no date
in the date colum in the grid

Nicholas Paldino said:
NuB,

Does the underlying column in the database support null values? If it
doesn't, and you are trying to update the value with null, you will get an
error.

Or are you getting a different error? If so, what are the details?

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

NuB said:
I have a grid on a winForm, where I can enter a date or leave it blank for
data entry. If I have a data field blank I get a DBNull value error, how
can I allow a blank date field in my grid be passed into the database
without getting a DBNull error?
 

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

Back
Top