SQL Express 2008 データベースのテーブルに情報を挿入しようとしていますが、フィールドを挿入しようとすると、「',' 付近の構文が正しくありません」というエラーが表示されます。問題?
protected void insertworkshop_Click(object sender, EventArgs e)
{
using (SqlConnection conn2 = new SqlConnection(@"Data Source=CIS489_3\WILDLIFE;Initial Catalog=WildLife_Education;Integrated Security=True;"))
{
SqlCommand CmdSql2 = new SqlCommand("INSERT INTO [tblWorkshop] ([WorkshopName], [WorkshopBeginingDate], [WorkshopEndingDate], [WorkshopLocation], [InstructorID])VALUES (@WorkshopName, @WorkshopBeginingDate, @WorkshopEndingDate, @WorkshopLocation, @InstructorID)", conn2);
conn2.Open();
CmdSql2.Parameters.AddWithValue("@WorkshopName", workshopinsertname.Text.ToString());
CmdSql2.Parameters.AddWithValue("@WorkshopBeginingDate", workshopinsertstart.Text.ToString());
CmdSql2.Parameters.AddWithValue("@[WorkshopEndingDate", workshopinsertend.Text.ToString());
CmdSql2.Parameters.AddWithValue("@WorkshopLocation", workshopinsertlocation.Text.ToString());
CmdSql2.Parameters.AddWithValue("@InstructorID", insertinstructorid.SelectedValue.ToString());
CmdSql2.Connection = conn2;
CmdSql2.ExecuteNonQuery();
conn2.Close();
UpdateInsertWorkshop.Update();
this.addnewworkshop_ModalPopupExtender.Hide();
}