ODBC export to Excel data type problem.
Hi. I am having problem with setting "time" type of data in excel output
file and have lost any idea about how to do it to work properly.
Some code from program:
sSql.Format("DRIVER={%s};DSN='';FIRSTROWHASNAMES=1;FIL=excel
97;READONLY=FALSE;CREATE_DB=\"%s\";DBQ=%s", strExcelDriver, strFileName,
strFileName);
//strExcelDriver = "Microsoft Excel Driver (.xls)"
//strFileName is name given by a choose name dialog
database.OpenEx(sSql,CDatabase::noOdbcDialog)
strTableName = _T("Rozmowy przychodz?ce");
strFieldNames = CString("[Numer CLIP] TEXT,");
strFieldNames += _T("Data DATE,");
strFieldNames += _T("Godzina TIME,");
strFieldNames += _T("Abonent TEXT,");
strFieldNames += _T("[Opis abonenta] TEXT,");
strFieldNames += _T("Linia TEXT,");
strFieldNames += _T("[Czas trwania] TIME");
sSql.Format("CREATE TABLE [%s] (%s)", strTableName, strFieldNames);
database.ExecuteSQL(sSql);
And later, into the "Godzina" and "Czas trwania" columns values like
'08:50:07'", '00:00:08' are inserted. But in the output file these colums
are generated as Date type with values like "12-30-1899", and after I
manually change it to Time type, it is shown properly. But I want it to be
shown as Time type without this change. Is it any way to do this?