ADO update a date field

Results 1 to 2 of 2

Thread: ADO update a date field

  1. #1
    Join Date
    Dec 1969

    Default ADO update a date field

    I am trying to add a record to an Access table that includes a date field and the update fails. Here is code, can anyone tell me what I&#039m doing wrong? Thanks in advance.<BR>&#060;%@ Language=VBScript %&#062;<BR>&#060;% Option Explicit %&#062;<BR>&#060;!--#include file="databaseconnect.asp"--&#062;<BR>&#060;!--#include virtual="/"--&#062;<BR>&#060;HTML&#062;<BR>&#060;BODY&#062;<BR> &#060;%<BR> Dim objRS<BR> Set objRS = Server.CreateObject("ADODB.Recordset")<BR> objRS.Open "tbltest", objConn, , adLockOptimistic, adCmdTable<BR> objRS.AddNew <BR> objRS.Fields("test").value = "This is a test!"<BR> objRS.Fields("date").value = #8/8/00#<BR> objRS.Update <BR> objRS.Close<BR> Set objRS = Nothing<BR> objConn.Close<BR> Set objConn = Nothing<BR>%&#062; <BR> Post Complete! <BR> &#060;/BODY&#062;<BR>&#060;/HTML&#062;

  2. #2
    Markkk Guest

    Default RE: ADO update a date field

    The problem is likely to be with the field name "date".<BR><BR>For some reason whenever ADO comes across a field named "date", it gets confused with the VB Function Date().<BR><BR>I suggest that you rename the "date" field in your database to something different (e.g. "date submitted", "date1", etc.)<BR><BR>This should solve one of your problems.<BR><BR>Also, you may want to check all the fields in the "tbltest" Table and make sure that there exists no other fields that may be REQUIRED. If a particular field (say, "test") requires a non-NULL entry, and you enter NULL, the database table UPDATE will fail.<BR><BR>I hope this helps!!

Posting Permissions

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