コードはほぼ完成しましたが、デフォルト値または SQL のバインドに問題があります。
これが私のデータベースです:
- *Date_Contact DateTime* (デフォルト値は
getdate()
) Readed, Status bit
(デフォルト値は0
)
それらはすべてヌル可能です。
これが私のコードです:
protected void btnSendMess_Click(object sender, EventArgs e)
{
try {
ContactUs contact_us = new ContactUs();
contact_us.FullName = txtName.Text;
contact_us.Email = txtEmail.Text;
contact_us.Subject = txtSubject.Text;
contact_us.Message = memoMess.Text;
db.ContactUs.InsertOnSubmit(contact_us);
db.SubmitChanges();
lblNotice.Text = "Your message sent successfully! Thank you";
}
catch (Exception) {
Response.Write("Error! Check your message again");
}
}
データベースをチェックインすると、Date_Contact
、Readed
および... コードの何が問題になっていますかStatus
?NULL