且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

外部组件引发的异常。

更新时间:2021-12-04 00:52:06

你为什么要做这样奇怪的事情:

Why do you do such weird things like:
string d = Request.QueryString["ava"];
DateTime a = Convert.ToDateTime(d);
txtEff.Text = d;
//insert.Parameters.AddWithValue("@LoanAvailableFrom", DateTime.Parse(txtEff.Text));



而不是 Convert.ToDateTime 使用 DateTime.ParseExact ,然后直接将该值用于SQL查询而不是TextBox内容:

insert.Parameters.AddWithValue(@ LoanAvailableFrom,a);

当然,您还应该更好地命名变量。


Instead of Convert.ToDateTime use DateTime.ParseExact, and then use that value directly for your SQL query instead of a TextBox content:
insert.Parameters.AddWithValue("@LoanAvailableFrom", a);
Of course, you should also take care of better naming of your variables.