// SendTime是在Access数据库中是文本类型
StringBuilder sb = new StringBuilder();
sb.Append("SELECT * FROM tb_MessSendLog WHERE 1=1 ");
sb.Append(" AND Type='" + sType + "'");
sb.Append(" and CDate(SendTime)>=CDate('" + Convert.ToDateTime(dDateS).ToString() + "')");
sb.Append(" and CDate(SendTime)<=CDate('" + Convert.ToDateTime(dDateE).ToString() + "')");
SqlCommandBase cmd = SqlBuilder.BuildSqlCommandBase(sb.ToString());
DataTable dt = DataProvider.Instance.GetTable(_Loginer.DBName, cmd.SqlCommand, tb_MessSendLog.__TableName);
return dt;
--以下是搜索结果
SELECT ID,PName,PDate from testtable where cdate(PDate)>=cdate('2009-7-1 0:00') and cdate(PDate)<=cdate('2009-7-18 0:00') ---或SELECT ID,PName,PDate from testtable where cdate(PDate)>=#2009-7-10:00# and cdate(PDate)<=#2009-7-18 0:00#