![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
|
We are using C# in Visual Studio 2005 to write time values to an Informix Database (Sun Solaris 2.6, Informix SE and Informix SQL Version 7.20.UD1). The following are excerpts: Statement 1: sql += 56 + "," + 2007/09/13 + ","; Table result 1 1900/01/17 ###### Statement 2 sql += 56 + "," + "2007/09/13" + ","; Actual sql string via watch value 2 "Insert into timeclock (tc_serial,tc_asoc_num,tc_process_num,tc_date,tc_s tart_time, tc_finish_time, tc_elapsed_time) values(0,9999,56,2007/09/13,8.3,8.35,0.35)" Table result 2 exception {"[Informix][Informix ODBC Driver][Informix]A syntax error has occurred."} System.Exception {System.Runtime.InteropServices.COMException ###### Statement 3 sql += 56 + "," + 0x22 + "2007/09/13" + 0x22 + ","; Actual sql string via watch value 3 "Insert into timeclock (tc_serial,tc_asoc_num,tc_process_num,tc_date,tc_s tart_time, tc_finish_time, tc_elapsed_time) values(0,9999,56,342007/09/1334,8.3,8.35,0.35)" Table result 3 exception {"[Informix][Informix ODBC Driver][Informix]A syntax error has occurred."} System.Exception {System.Runtime.InteropServices.COMException} ###### Statement 4 sql += 56 + "," + 0x22 + 2007/09/13 + 0x22 + ","; Actual sql string via watch value 4 "Insert into timeclock (tc_serial,tc_asoc_num,tc_process_num,tc_date,tc_s tart_time, tc_finish_time, tc_elapsed_time) values(0,9999,56,341734,8.3,8.35,0.35)" Table result 4 tc_date [2835/08/20] Any ideas on how to write this so that Informix will accept the date field? Spyros Macris, President Philadelphia Candies, Inc. 1546 East State Street Hermitage, PA 16148 Phone: 724 981 6341 Fax: 724 981 6490 Spyros Macris, President Philadelphia Candies, Inc. 1546 East State Street Hermitage, PA 16148 Phone: 724 981 6341 Fax: 724 981 6490 |
#2
| |||
| |||
|
|
sql += 56 + "," + "{D '2007/09/13'}" + ","; This is as per the ODBC escape sequence standard and correct way of using |
|
We are using C# in Visual Studio 2005 to write time values to an Informix Database (Sun Solaris 2.6, Informix SE and Informix SQL Version 7.20.UD1). The following are excerpts: Statement 1: sql += 56 + "," + 2007/09/13 + ","; Table result 1 1900/01/17 ###### Statement 2 sql += 56 + "," + "2007/09/13" + ","; Actual sql string via watch value 2 "Insert into timeclock (tc_serial,tc_asoc_num,tc_process_num,tc_date,tc_s tart_time, tc_finish_time, tc_elapsed_time) values(0,9999,56,2007/09/13,8.3,8.35,0.35)" Table result 2 exception {"[Informix][Informix ODBC Driver][Informix]A syntax error has occurred."} System.Exception {System.Runtime.InteropServices.COMException ###### Statement 3 sql += 56 + "," + 0x22 + "2007/09/13" + 0x22 + ","; Actual sql string via watch value 3 "Insert into timeclock (tc_serial,tc_asoc_num,tc_process_num,tc_date,tc_s tart_time, tc_finish_time, tc_elapsed_time) values(0,9999,56,342007/09/1334,8.3,8.35,0.35)" Table result 3 exception {"[Informix][Informix ODBC Driver][Informix]A syntax error has occurred."} System.Exception {System.Runtime.InteropServices.COMException} ###### Statement 4 sql += 56 + "," + 0x22 + 2007/09/13 + 0x22 + ","; Actual sql string via watch value 4 "Insert into timeclock (tc_serial,tc_asoc_num,tc_process_num,tc_date,tc_s tart_time, tc_finish_time, tc_elapsed_time) values(0,9999,56,341734,8.3,8.35,0.35)" Table result 4 tc_date [2835/08/20] Any ideas on how to write this so that Informix will accept the date field? Spyros Macris, President Philadelphia Candies, Inc. 1546 East State Street Hermitage, PA 16148 Phone: 724 981 6341 Fax: 724 981 6490 Spyros Macris, President Philadelphia Candies, Inc. 1546 East State Street Hermitage, PA 16148 Phone: 724 981 6341 Fax: 724 981 6490 |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |