Results 1 to 2 of 2

Thread: stuck

  1. #1
    Join Date
    Jan 2003
    Posts
    2

    Question stuck

    Confused newbie that I am. I could use a little advice.
    I get this error if I try to inset an empty string into a DateTime field.
    Data type mismatch in criteria expression.
    Is there any way to include an if statement or something that will bypass inseting anything into this DateTime field if I try to pass an empty string to it?
    I'm using SQL and ASP.

  2. #2
    Join Date
    Dec 2002
    Posts
    181
    First make your datetime field nullable.
    Then you will need some logic in your asp page:

    <%

    cmdText = " Select * from sometable "
    Set rs = CreateObject("ADODB.Recordset")
    With rs
    .ActiveConnection = cn
    .CursorType = 2
    .LockType = 3
    .Open cmdText
    End With

    ' If statement to handle blank form value
    if request("SomeDateColumn") <> "" then
    rs("SomeDateColumn") = request("SomeDateColumn")
    else
    rs("SomeDateColumn") = null
    end if


    rs.Update

    %>



    Jeff

Posting Permissions

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