hi, i am using wxWindows-2.4.2 and i am developing the attendance system using smart card, i am using mysql as back hand. To connect with database i am using ODBC driver. my problem: when i am trying to access the table having column with datatype as DATE. for this table i am using the wxDbTable class to create the table object for the sql database table. by using this object i am specifying column information by using SetColDef() function of wxDbTable class. in this i have to specify all constraints of the column, in this for data type i have used the identifier SQL_C_DATE. now when i am trying to delete any record using Delete() function of the wxDbTable class, in this it first build the where clause, in which according to the identifier it will build the where statement. in source code it just like following
file name is : dbtable.cpp
for (i = 0; i < noCols; i++)
{
if ((typeOfWhere == DB_WHERE_KEYFIELDS && colDefs[i].KeyField) ||
(typeOfWhere == DB_WHERE_MATCHING && (!IsColNull(i))))
{
if (colDefs[i].SqlCtype == SQL_C_TIMESTAMP)
continue;
if (moreThanOneColumn)
pWhereClause += wxT(" AND ");
else
moreThanOneColumn = TRUE;
if (qualTableName.Length())
{
pWhereClause += pDb->SQLTableName(qualTableName);
pWhereClause += wxT(".");
}
pWhereClause += pDb->SQLColumnName(colDefs[i].ColName);
if (useLikeComparison && (colDefs[i].SqlCtype == SQL_C_CHAR))
pWhereClause += wxT(" LIKE ");
else
pWhereClause += wxT(" = ");
switch(colDefs[i].SqlCtype)
{
case SQL_C_CHAR:
colValue.Printf(wxT("'%s'"), (UCHAR FAR *) colDefs[i].PtrDataObj);
break;
case SQL_C_SSHORT:
colValue.Printf(wxT("%hi"), *((SWORD *) colDefs[i].PtrDataObj));
break;
case SQL_C_USHORT:
colValue.Printf(wxT("%hu"), *((UWORD *) colDefs[i].PtrDataObj));
break;
case SQL_C_SLONG:
colValue.Printf(wxT("%li"), *((SDWORD *) colDefs[i].PtrDataObj));
break;
case SQL_C_ULONG:
colValue.Printf(wxT("%lu"), *((UDWORD *) colDefs[i].PtrDataObj));
break;
case SQL_C_FLOAT:
colValue.Printf(wxT("%.6f"), *((SFLOAT *) colDefs[i].PtrDataObj));
break;
case SQL_C_DOUBLE:
colValue.Printf(wxT("%.6f"), *((SDOUBLE *) colDefs[i].PtrDataObj));
break;
case SQL_C_DATE:
colValue.Printf(wxT("'%s'"), ((UCHAR FAR *) colDefs[i].PtrDataObj);
}
pWhereClause += colValue;
}
} so now my problem is that ther is no identifier available for the SQL_C_DATE type in the above case statement. so is there any solution for this , if you find then please reply as soon as possible because it is very urgent. |