我想从用户选择到数据库中的日历中存储日期。 它似乎没有将其插入到Access数据库中。 DB字段的数据类型是日期/时间,变量如下。 我知道我的查询工作正常,因为其他信息存储正确。C#ASP.NET - 从日历插入日期到数据库
DateTime dtUserDate;
dtUserDate = calenderUserDate.SelectedDate;
string myQuery = "INSERT INTO MMK(Name, Email, Address, Town, County, PostCode, Country, Telephone, Date Joined) VALUES ('" + strName + "' , '" + strEmail + "' , '" + strAddress + "' , '" + strTown + "' , '" + strCounty + "' , '" + strPostCode + "' , '" + strCountry + "' , '" + strTeleNumber + "' , '" + dtUserDate+ "')";
感谢
“DAT e Joined“不是有效的字段名称,这可能是问题,也可能只是其中的一部分 – musefan
您需要阅读[SQL注入](http://en.wikipedia.org/wiki/) SQL_injection),因为你当前的代码是一个安全问题 – musefan