【发布时间】:2013-08-27 19:14:45
【问题描述】:
朋友...
在我的 ms 访问数据库中,我存储日期格式 dd-MMM-yy。 并在搜索查询中将日期作为参数传递。 但我的系统不能包含日期格式 mm/dd/yyyy 那么,在将此日期传递给查询之前,我如何将这种格式转换为 dd-MMM-yy 现在,我正在使用以下代码..但是给出错误..字符串未被识别为有效的日期时间。
DateTime dt = DateTime.ParseExact(startdate.ToString(), "dd-MMM-yy",
CultureInfo.InvariantCulture);//startdate is datepicker
查询...
s = new OleDbDataAdapter("
SELECT opd_patient_master.*, patient_operation.*
FROM opd_patient_master, patient_operation
WHERE opd_patient_master.pid= patient_operation.pid
and opd_patient_master.rdid= patient_operation.rdid
and odate >= #" + startdate + "# and odate<=# " + enddate + "#
and operation= '" + oprtype + "'", mycon);
【问题讨论】:
-
和
enddate也是DateTimePicker?
标签: c# ms-access-2007