-
C++ ADO sql
Hi everybody!
First, sorry my bad english.
I'm trying to pass two parameters for a Recordset, in a sql query, like this:
sql.Format("SELECT * FROM dbo_vendas WHERE vn_id = %d", m_idcTxtID);
and it works. but a have to implement a sql with a field "date" that
comes from a CEdit, who is filled by user.
like this:
sql.Format("SELECT * FROM dbo_vendas WHERE vn_id = %d and vn_date = '%s'", m_idcTxtID, m_Date);
I have tried to convert using CTime COleTime, but nothing works.
Can someone give some light on this?
Thanks a lot!
-
Re: C++ ADO sql
Not exactly the same but you can get the idea from here...."ChangeDateTime" is defined as a "datetime" in SQL Server...
Code:
memset(szTemp, (char)NULL, sizeof(szTemp));
sprintf(szTemp,"%2.2d/%2.2d/%4.4d %2.2d:%2.2d:%2.2d", (sTime->tm_mon+1),sTime->tm_mday,(sTime->tm_year+1900),sTime->tm_hour,sTime->tm_min,sTime->tm_sec);
pLocalRecordset->PutCollect(L"ChangeDateTime", _variant_t(szTemp));
-
Re: C++ ADO sql
-
Re: C++ ADO sql
Glad it helped...good luck with the project....:wave: