inserting datetime

Results 1 to 2 of 2

Thread: inserting datetime

  1. #1
    Join Date
    Dec 1969

    Default inserting datetime

    Hi,<BR><BR>I am having problem inserting date into the SQL7 database. The code : <BR><BR>strSql = " INSERT INTO tb_history VALUES(" & request.form("rid") & ","<BR>strSql = strSql & request.form("uid") & ","<BR>strSql = strSql & strAdd & ","<BR>strSql = strSql & strTotal& ","<BR>strSql = strSql & date & ")"<BR><BR><BR>When I response write the sql statement, it returns :<BR>INSERT INTO tb_history VALUES(1,124,100,10,2/27/2003) <BR><BR>There&#039;s no error but when I check the database, the date is 01/01/1900. Strangely if I use another method to insert, it works fine :<BR><BR> Set objRS = Server.CreateObject("ADODB.Recordset")<BR> objRS.Open "tb_history", oConn, adOpenKeySet, adLockOptimistic, adCmdTable<BR> objRS.AddNew<BR><BR> objRS("RID") = "123"<BR> objRS("SID") = "123"<BR> objRS("CREDIT") = "123"<BR> objRS("TOTAL") = "123"<BR> objRS("DATE") = date<BR><BR> objRS.Update<BR><BR>Can anyone figure out the reason?.....please.....<BR>(I use the first method on most of my code so I don&#039;t want to change it unless I can&#039;t solve the problem)<BR><BR>James

  2. #2
    Join Date
    Dec 1969

    Default RE: inserting datetime

    INSERT INTO tb_history VALUES(1,124,100,10,&#039;2/27/2003&#039;) :-)

Posting Permissions

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