Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004
    Posts
    2

    Question Unanswered: Help with inserting nulls into DB through ASP

    I have a record update page that when it updates an empty field in the SQL database it removes the <NULL> vales from the cell and replaces them with a blank. I need the nulls in there for a large part of my SQL script. What should commadn should I use to keep the <null> value? Also say I change a field that previously had data, to no data, and update. The cell updates to being blank, I would like it to update and show the <null> value.

    Any help would be greatly appreciated,

    Thanks again,

    Brendon

  2. #2
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    The SQL would look similar to:

    UPDATE Table1 SET Text = NULL WHERE ID = 1

    Of course, you'd change "Table1" to your table name, "Text" to the field you're setting to NULL, ID to your key field, and the value "1" to a variable representing whichever record you're attempting to update.
    That which does not kill me postpones the inevitable.

  3. #3
    Join Date
    Jan 2004
    Location
    India
    Posts
    31

    use vbNull

    hi try using vbNull

    <%
    dim rsAddNull
    set rsAddNull=Server.CreateObject("ADODB.Recordset")
    rsAddNull.Open "Table1",objConn,adOpenDynamic,adLockOptimisti c
    rsAddNull.AddNew
    rsAddNull("Col1")=vbNull
    rsAddNull("Col1")="test"
    rsAddNull.Update
    rsAddNull.Close
    set rsAddNull=nothing
    %>
    Attached Files Attached Files
    Do not walk behind me, for I may not lead.
    Do not walk ahead of me, for I may not follow.
    Do not walk beside me, either.
    Just leave me alone.

    Yogesh Jangam
    http://yogeshjangam.blogspot.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •