Re: Set column to null

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: SB (sb999_at_itmc.be)
Date: 03/02/04


Date: Tue, 2 Mar 2004 20:30:21 +0100

Eric
You have to use the DbNull value instead of null
Selim
"Eric V" <anonymous@discussions.microsoft.com> wrote in message
news:4177F06E-534D-4707-B4C2-2B774D6D3700@microsoft.com...
> how do i set a column to null in a datatable? i tried this:
>
> foreach(DataRow row in myTable.Rows)
> {
> row["myColumn"]=null;
> }
>
> but it fails. myColumn is a Long type. i know it can accept nulls because
i get some nulls from the database.
>
> thanks



Relevant Pages

  • Re: Cast from type DBNull to type String is not valid.
    ... I would say yes, check if they are not DBNull before asigning them, but only ... in those records you know that could have a null (Allow nulls). ... > Tom. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Set column to null
    ... but it fails. ... myColumn is a Long type. ... i know it can accept nulls because i get some nulls from the database. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Why does the SqlParamater fail on DBNull values?
    ... That it accepts nulls is all fine and good except if your data type is ... > The following code snippet fails if the column contains a DBNull value. ...
    (microsoft.public.dotnet.framework.adonet)
  • RE: Set column to null
    ... For database stuff, ... but it fails. ... myColumn is a Long type. ... i know it can accept nulls because i get some nulls from the database. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: What does this NULL mean?
    ... > always will be NULLS in the real world." ... > comp.databases.theory thread "Does Codd's view of a relational database ... > presenting lots of possible reasons was a very bad argument because only ... management of systems with evolving schema, ...
    (comp.databases.theory)