Adding Null to a column

Discussion in 'ASP .Net' started by Patrick Olurotimi Ige, Mar 18, 2005.

  1. I'm trying to add NULL to a column in the database but the sql below
    isn't updating?

    if (name=="")
    {
    strCmd += "UPDATE";
    strCmd += " EMPLOYEEDETAILS SET ";
    strCmd+= "name='"+null+"',designation='"+desg+"',sex='"+sex+"'
    ,age="+age+" , salary="+salary+" where id="+id;
    }




    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Patrick Olurotimi Ige, Mar 18, 2005
    #1
    1. Advertising

  2. Update TableName Set Column1 = null (No quotes)

    HTH
    Regards,
    Jignesh Desai
    www.dotnetjini.com
    "Patrick Olurotimi Ige" <> wrote in message
    news:%...
    > I'm trying to add NULL to a column in the database but the sql below
    > isn't updating?
    >
    > if (name=="")
    > {
    > strCmd += "UPDATE";
    > strCmd += " EMPLOYEEDETAILS SET ";
    > strCmd+= "name='"+null+"',designation='"+desg+"',sex='"+sex+"'
    > ,age="+age+" , salary="+salary+" where id="+id;
    > }
    >
    >
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    Jignesh Desai, Mar 18, 2005
    #2
    1. Advertising

  3. Patrick Olurotimi Ige

    Elton Wang Guest

    Hi Patrick,

    Use NULL without single quotation mark, e.g. SET name =
    NULL .

    HTH

    Elton Wang


    >-----Original Message-----
    >I'm trying to add NULL to a column in the database but

    the sql below
    >isn't updating?
    >
    >if (name=="")
    >{
    >strCmd += "UPDATE";
    >strCmd += " EMPLOYEEDETAILS SET ";
    >strCmd+= "name='"+null+"',designation='"+desg+"',sex='"+se

    x+"'
    >,age="+age+" , salary="+salary+" where id="+id;
    >}
    >
    >
    >
    >
    >*** Sent via Developersdex http://www.developersdex.com

    ***
    >Don't just participate in USENET...get rewarded for it!
    >.
    >
     
    Elton Wang, Mar 18, 2005
    #3
  4. Patrick,

    Please try not to double post. If you looked at the post you made earlier
    today at 1:53am then you would have gotten the answer to your question.



    "Patrick Olurotimi Ige" <> wrote in message
    news:%...
    > I'm trying to add NULL to a column in the database but the sql below
    > isn't updating?
    >
    > if (name=="")
    > {
    > strCmd += "UPDATE";
    > strCmd += " EMPLOYEEDETAILS SET ";
    > strCmd+= "name='"+null+"',designation='"+desg+"',sex='"+sex+"'
    > ,age="+age+" , salary="+salary+" where id="+id;
    > }
    >
    >
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    Tampa.NET Koder, Mar 18, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kivak Wolf
    Replies:
    2
    Views:
    10,117
    Kivak Wolf
    Jun 28, 2005
  2. vizlab
    Replies:
    3
    Views:
    4,270
    Michael Bar-Sinai
    Oct 17, 2007
  3. Replies:
    16
    Views:
    7,425
    Mike Schilling
    Oct 12, 2005
  4. Replies:
    5
    Views:
    27,517
    Mike Schilling
    Mar 29, 2006
  5. Bo Peng
    Replies:
    13
    Views:
    13,481
    Siemel Naran
    Jul 18, 2004
Loading...

Share This Page