If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Help with inserting nulls into DB through ASP

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-29-04, 21:29
GTPBoy GTPBoy is offline
Registered User
 
Join Date: Apr 2004
Posts: 2
Question 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
Reply With Quote
  #2 (permalink)  
Old 04-30-04, 11:36
Seppuku Seppuku is offline
Useless...
 
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.
Reply With Quote
  #3 (permalink)  
Old 05-03-04, 07:54
yoja7 yoja7 is offline
Registered User
 
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
File Type: zip AddNulltoDB.zip (695 Bytes, 15 views)
__________________
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.*************
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On