【发布时间】:2015-02-12 19:54:14
【问题描述】:
我将此脚本用作日期选择器:
<script type="text/javascript">
$(function () {
$("[id$=txtDate]").datepicker({
dateFormat: 'dd/m/yy',
showOn: 'button',
buttonImageOnly: true,
buttonImage: 'http://192.168.211.71/Imagens/calendar_icon.png'
});
});
</script>
$("[id$=txtDate]").datepicker({ 在这一行中,我将日期选择器分配给 txtDate 控件(文本框)。当我尝试将其作为参数添加到存储过程时出现问题:
Cmd.Parameters.Add("@DataPedido", Data.SqlDbType.DateTime).Value = DateTime.ParseExact(TxtDate.Text, "dd/M/yyyy", Nothing)
我得到String was not recognized as a valid DateTime.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
如何正确地将文本框的值解析为 DateTime?
【问题讨论】: