Update Access 2000 Date/Time field error 
Author Message
 Update Access 2000 Date/Time field error

I have a table with a field of type Date/Time, in general date format,
that is, for example :
11/28/2001 12:34:56 pm

How may I update it ?
I tried the codes below but they did not work

CDatabase database;
CString SqlString;
CString sDriver = "MICROSOFT ACCESS DRIVER (*.mdb)";
CString sDsn;
CString sFile = "c:\\m.mdb";

sDsn.Format("ODBC;DRIVER={%s};DSN='';DBQ=s;",sDriver,sFile);

database.Open(NULL,false,false,sDsn);
CString SqlString;

CTime time;
time = CTime::GetCurrentTime();
CString str;
str = time.Format("%d/%m/%Y %H:%M:%S");

CString SqlString;
SqlString.Format("UPDATE MyTable SET DateTimeField = '%s' WHERE ID = 3", str)
database.ExecuteSQL(SqlString);

The error shown is like below :

Database error: Syntax error in UPDATE statement



Mon, 17 May 2004 13:36:18 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Can't read time from Access 2000 date/time field

2. Date/Time field in Access db

3. Memory access violation using CRecordset and date/time fields

4. Change date field type from long to Date/Time

5. GUID fields in Access 2000?

6. Problems with updating an Access 2000 database using CDatabase and CRecorset-derived class in MFC

7. Problems with update on an Access 2000 database.

8. Update a date-field with ADO

9. MFC bug when updating date fields in CRecordset ?

10. Updating date fields in CRecordset

11. Unrecognized database error after upgrading to Access 2000

12. DAO Error with Access 2000

 

 
Powered by phpBB® Forum Software