sqlite按日期变量查询,该如何处理

sqlite按日期变量查询
由date time picker控件和编辑框控件获得时间变量,代码如下:
m_oSdate.GetWindowText(ssdate);
ssdate=Dateformat(ssdate);
m_oSt.GetWindowText(sstime);
sbegin=ssdate+" "+sstime;
m_oListreport.AddString("开始时间: "+sbegin);
  sbegin.Format(_T("%d-%d-%d\n%d:%d:%d"));

m_oOdate.GetWindowText(sodate);
sodate=Dateformat(sodate);
m_oOt.GetWindowText(sotime);
send=sodate+" "+sotime;
m_oListreport.AddString("结束时间: "+send);
执行以下sql语句:
sql1="select sum(消费金额【元】) from sam where 时间>='"+sbegin+"' and 时间<='"+send+"'";
  char cSQL[255];
  strcpy(cSQL, (LPCSTR)_bstr_t(sql1));
  char *pChar = cSQL;
   
rc1=sqlite3_get_table( db1 , pChar , &azResult1 , &nrow1 , &ncolumn1 , &zErr1);
ab=azResult1[1];
m_oListreport.AddString("总收入: " +ab);
编译顺利通过,但是在sbegin和send的范围内查询,却查询不出数据出来,自建的数据库是明明有数据。当将sebigin和send变量换成时间常量时(如2011-10-01 00:00:00)却能正常将查询结果显示出来。
求教,这个问题我搞了很久了,希望各位高手帮帮忙,感谢。。。。

------解决方案--------------------
sbegin.Format(_T("%d-%d-%d\n%d:%d:%d"));
sbegin并没有格式化成2011-10-01 00:00:00类似的字符串。