smn
July 22nd, 1999, 02:58 AM
In my program,a date input by user is stored in a variable named "d",
and I must pass it to SQLBindParameter to get records,these
records's data of "abc" field must be greater than d.
SQLDATE d[]="1996-12-30";//a variable stored with user's input
sr=SQLPrepare(stmt,(SQLCHAR*)"select * from stock where abc>{d ?}",SQL_NTS);
sr=SQLBindParameter(stmt,1,SQL_PARAM_INPUT, SQL_C_DATE,SQL_DATE,10,0,d,0,&length);
sr=SQLExecute(stmt);
sr returns SQL_ERROR,I don't know why.
I try to define d as CTime class,error;
Change {d ?} to {?} or ?,error;
Change 10,0 to SQL_TYPE_DATE,SQL_TYPE_DATE,error;
Change the last 0 to sizeof(d),error.
I can't find any example of this in books,it really stops my work.
Thank you all for reply or giving me suggestion.
I know that if I type this,sr returns success:
SQLExecDirect(stmt,(SQLCHAR*)"select * from stock where abc>{d '1996-12-30'}" (or abc>#1996/12/30#)
,SQL_NTS);
Best Regards
simon
smn@21cn.com
and I must pass it to SQLBindParameter to get records,these
records's data of "abc" field must be greater than d.
SQLDATE d[]="1996-12-30";//a variable stored with user's input
sr=SQLPrepare(stmt,(SQLCHAR*)"select * from stock where abc>{d ?}",SQL_NTS);
sr=SQLBindParameter(stmt,1,SQL_PARAM_INPUT, SQL_C_DATE,SQL_DATE,10,0,d,0,&length);
sr=SQLExecute(stmt);
sr returns SQL_ERROR,I don't know why.
I try to define d as CTime class,error;
Change {d ?} to {?} or ?,error;
Change 10,0 to SQL_TYPE_DATE,SQL_TYPE_DATE,error;
Change the last 0 to sizeof(d),error.
I can't find any example of this in books,it really stops my work.
Thank you all for reply or giving me suggestion.
I know that if I type this,sr returns success:
SQLExecDirect(stmt,(SQLCHAR*)"select * from stock where abc>{d '1996-12-30'}" (or abc>#1996/12/30#)
,SQL_NTS);
Best Regards
simon
smn@21cn.com