我想從用戶選擇到數據庫中的日曆中存儲日期。 它似乎沒有將其插入到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