CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2001
    Posts
    33

    Urgent :Store null date into table

    I have a field called dte which is a datetime type and allows null.
    But I can't insert a null date into it. I found out that dte only stores "1/1/1900", but not null

    .........
    .........

    drp = " " (I also tried drp = null, but it can't work)

    sql = "Insert Into Cus_TBL Values " & _
    "('" & Trim(txtID.Text) & "','" & _
    Yr & "','" & drp & "')"

    Please help me !
    It's urgent !!!


  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Urgent :Store null date into table

    Try drp without apostrophies around it

    ...Yr, drp & ")"

    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

  3. #3
    Join Date
    Feb 2001
    Posts
    33

    Re: Urgent :Store null date into table

    It can't work !!!


  4. #4
    Join Date
    Mar 2001
    Posts
    11

    Re: Urgent :Store null date into table

    try this

    sql = "Insert Into Cus_TBL Values ('" & Trim(txtID.Text) & "','" & Yr & "',"

    if drp = "" then
    sql = sql + "NULL"
    else
    sql = sql + '" & drp & "')"
    end if
    msgbox sql



Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured