ASP SQL Insert NULL Date Value

From: Chad S (webaccess_at_hotmail.com)
Date: 02/19/04


Date: Thu, 19 Feb 2004 08:19:04 -0800

Hello,

I've been pulling my hair out trying to figure this out. Thank you in
advance for taking the time to look at this.

I'm trying to insert a NULL value into my SQL Server 2000 database. I
have a datetime field called 'ProcedureDate' that is allowing NULL
values. When inserting a NULL, SQL always puts the date 1/1/1900. I'm
trying to leave this field blank if no date is entered.

Thank's Again !

Chad

------------------------

Here is my ASP Code that sets a NULL value if there is no date entered:

<%
If Request.Form("sProcedureDate1") = "0" OR
Request.Form("sProcedureDate2") = "0" OR Request.Form("sProcedureDate3")
= "0" Then

sProcedureDate = NULL

Else

sProcedureDate = Request.Form("sProcedureDate1") & "/" &
Request.Form("sProcedureDate2") & "/" & Request.Form("sProcedureDate3")

End If
%>

------------------------

Here is my ASP SQL Insert Code:

<%
rsInsert = "INSERT into tblProceduralInfo (" &_
        "PatientID, " &_
        "ValvePlacementDuring, " &_
        "ValvePlacementIn, " &_
        "PatientAdmittedTo, " &_
        "ProcedureDate, " &_
        "StartTime, " &_
        "EndTime " &_
        ")"
        
        rsInsert = rsInsert & "VALUES" &_
        "('" & Request.Form("sPatientID") &_
        "', '" & Request.Form("sValveDuring") &_
        "', '" & Request.Form("sValveIn") &_
        "', '" & Request.Form("sPatientAdmitted") &_
        "', '" & sProcedureDate &_
        "', '" & sStartTime &_
        "', '" & sEndTime &_
        "')"
        
        objConn.Execute(rsInsert)
%>

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Relevant Pages

  • Re: IISState log (IIS slow)
    ... Could be a bug in ODBC, could be a problem in the SQL, could be a problem ... w/an ASP page in an endless loop; inside the loop a query is being executed ... > comes to opening asp files(even sometimes without asp code in it/plain ... > IISState shows only that what I already know, how i could point out the ...
    (microsoft.public.inetserver.iis)
  • Re: IISState log (IIS slow)
    ... IIS processes pages normally without errors(only IIS Log sometimes throws ... AVG server load is 50-60% when IIS stops responding normally, ... comes to opening asp files(even sometimes without asp code in it/plain html). ... Same sql queries which I launch in asp, ...
    (microsoft.public.inetserver.iis)
  • Re: Storing only timepart in Sql server datetime
    ... I'm using a DateTime field in MS SQL 2000, and by using Delphi's Frac method ... > stuck with setting up a character data type for the time portion only. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Typed dataset: Time only data in SQL dateTime Field
    ... I can type in a Time alone directly into a sql DateTime field. ... I need to retain the format as it was in access. ... how be able to provide input to my typed dataset to replicate the behavior. ... I also noticed that the Sql import was able to replicate this format. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: ASP, looping, and stored procedures.... error 800a0bb9 ...
    ... I'm just going to include the .asp page here. ... > If your bottleneck turns out to be occurring in the ASP code itself rather ... > stored procedure, then you may want to think about utilizing GetRows ... >> Oh, and by the way, the test box has SQL server and IIS on it. ...
    (microsoft.public.inetserver.asp.db)