且构网

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

使用C#插入数据库

更新时间:2023-02-08 18:05:56

我添加了 .txtDob
.Text 属性.
cmd.Parameters.AddWithValue("@datBirth", txtDob.Text);


这行可能是问题-cmd.Parameters.AddWithValue("@datAdmission", txtdatAdmission);
确保在此字段中传递有效的日期时间格式.
This line could be the problem - cmd.Parameters.AddWithValue("@datAdmission", txtdatAdmission);
Make sure you pass a valid datetime format in this field.


需要在下面添加,以及Sunsara建议的

Need to add for below as well as Sunsara suggested

cmd.Parameters.AddWithValue("@datAdmission", txtdatAdmission);
           cmd.Parameters.AddWithValue("@strName", txtStudentName);