Hello all,
I´m sure this is a pretty basic question, but I´m quite a beginner so please
bear with me. I built a simple client with VC++ 6.0, and I´m accessing a
mySQL DB using myODBC 3.51. When trying to select a row from a table,
I use a query like that:

"SELECT * FROM datav WHERE (date_time >= ? AND date_time <= ? ) ORDER BY
date_time"

It´s prepared execution, and both "?" are supposed to be dates, whatever
format. "date_time" is a timestamp(14) column. I tried to bind the ?´s to
variables like "starttime" (and "endtime") below, which are taken from
CString´s in the convenient format "YYYY-MM-DD hh:mm:ss"  :

SQLTIMESTAMP starttime = (SQLTIMESTAMP)(LPCTSTR)m_strStartTime;

(m_strStartTime is the CString.)
I also tried the YYYYMMDDhhmmss format for the CString. Still, the freaking
query wont work, unless I manually input the ? values, but I need this to be
a prepared execution, not direct Exec.

In sum, the question is: How do I add time constrains to a query with
Prepared Execution? What formats must my variables have so that query can
work?

Thanks in advance,
Mateus Begossi





---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to