朋友...解析日期到dd-MMM-yy
在我的MS訪問數據庫我存儲日期格式dd-MMM-yy。 並在搜索查詢中傳遞日期作爲參數。 但我的系統cantain日期格式mm/dd/yyyy 因此,如何在dd-MMM-yy中將此格式轉換爲現在查詢 之前,我使用folling代碼..但給錯誤....字符串未被視爲有效的日期時間。
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'? –