Dates in SQL Server Nightmare

Results 1 to 3 of 3

Thread: Dates in SQL Server Nightmare

  1. #1
    Join Date
    Dec 1969

    Default Dates in SQL Server Nightmare

    all I want to do is input a date submitted from a form but can&#039;t seem to get the bugger to to work.<BR><BR>code as follows<BR><BR>mDate = Request.Form("datething")<BR>insert into tbl_name (datefield) values (&#039;"&mDate&"&#039;)<BR><BR>i get the following error<BR><BR>The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.<BR><BR>tried this mdate = CDate(mDate) that didn&#039;t work<BR><BR>run out of ideas?

  2. #2
    Join Date
    Dec 1969

    Default RE: Dates in SQL Server Nightmare

    If you do a Response.Write mDate what does it tell you?<BR><BR>Are you sure mDate is a date?<BR><BR>Cheers<BR>Tim

  3. #3
    Join Date
    Dec 1969

    Default Bill's mantra: DEBUG DEBUG DEBUG

    Since you aren&#039;t showing real code, how can we guess what (other) mistakes you have made???<BR><BR>And the most valuable thing you can do is, as the other poster said, Response.Write your SQL string before using it.<BR><BR>&#060;%<BR>mDate = Request.Form("datething")<BR>If Not isDate( mDate ) Then<BR> Response.Write "That is NOT a legal date: " & mDate <BR> Response.End<BR>End If<BR>SQL = "insert into tbl_name (datefield) values ( &#039;" & mDate & "&#039;)"<BR>Response.Write "DEBUG: SQL is " & SQL & "&#060;HR&#062;"<BR>...<BR>%&#062;<BR><BR><BR> <BR>

Posting Permissions

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