Re: DBnull, Date and DataAdapter
From: Marina (someone_at_nospam.com)
Date: 01/05/05
- Next message: Eric Barr: "GetChildRows - Finding Deleted ChildRows ?"
- Previous message: blue_nirvana: "Re: DBnull, Date and DataAdapter"
- In reply to: blue_nirvana: "Re: DBnull, Date and DataAdapter"
- Next in thread: Cor Ligthert: "Re: DBnull, Date and DataAdapter"
- Reply: Cor Ligthert: "Re: DBnull, Date and DataAdapter"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 5 Jan 2005 13:03:56 -0500
NO, that is not true. Assigning DBNull.Value to a date column should work
just fine.
I think the issue is that the typed DataSet has a strongly typed column.
Whereas in a regular one, everything is of type Object, so assignment to
DBNull.Value can be compiled. I am guessing this is a compile time issue?
Your posts are very vague and do not provide all the details of your
problem. Remember, people reading this newsgroup have no idea of your
situation,you have to be very specific.
I would look for a method in the typed datatable or datarow that can set the
column to NULL. In this case, you would never be able to set a column of any
type to DBNull.Value, since they would all have a specific type (String,
Integer, etc.).
"blue_nirvana" <bluenirvana@discussions.microsoft.com> wrote in message
news:9F0922B5-24A2-4143-9667-09A5E7760A03@microsoft.com...
> I have a strongly-type dataset with a datatable from SQL Server. This
> datatable has a column called CloseDate that allows nulls. But when
trying
> to assign DbNull.Value to the column in code, I get "Value of type
> 'System.DbNull' cannot be converted to 'Date'. For example, dr.CloseDate
=
> DbNull.Value
>
> I read somewhere that you cannot update a datetime column in SQL Server
> using a DataAdapter. Is that true? If not, how do you assign a null
value
> to a datetime column in a SQL Server table using a DataAdapter?
>
> Thanks
>
> "Marina" wrote:
>
> > Are you talking about call the Update method on a dataset? What do you
mean
> > by 'using a SqlDataAdapater'?
> >
> > "blue_nirvana" <bluenirvana@discussions.microsoft.com> wrote in message
> > news:E1E2A7CB-9114-4DF8-984A-F5DC2654FA46@microsoft.com...
> > > Is there a way to assign a datetime column in SQL Server to Null using
a
> > > SQLDataAdapter? I know you can do it by calling a stored procedure
and
> > > setting a parameter equal to DBnull.Value. But it does not make since
to
> > me
> > > that you can not set a datetime column to null from a SQLDataAdapter.
> > >
> > > Thanks
> >
> >
> >
- Next message: Eric Barr: "GetChildRows - Finding Deleted ChildRows ?"
- Previous message: blue_nirvana: "Re: DBnull, Date and DataAdapter"
- In reply to: blue_nirvana: "Re: DBnull, Date and DataAdapter"
- Next in thread: Cor Ligthert: "Re: DBnull, Date and DataAdapter"
- Reply: Cor Ligthert: "Re: DBnull, Date and DataAdapter"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|