第 1 行: ',' 附近有语法错误。????
private void Button1_Click(object sender, System.EventArgs e)
{
string strCommand="insert Ex06_04(ID,姓名,性别,年龄,职业) values('"+TextBox1.Text+"','"+TextBox2.Text+"','"+RadioButtonList1.Items.ToString()+"','"+TextBox3.Text+"','"+DropDownList1.Items.ToString()+"')";
SqlCommand addInfo=new SqlCommand(strCommand,myConnection);
myConnection.Open();
addInfo.ExecuteNonQuery();
myConnection.Close();
Response.Redirect("WebForm1.aspx");
}
异常详细信息: System.Data.SqlClient.SqlException: 第 1 行: ',' 附近有语法错误。
源错误:
行 69: SqlCommand addInfo=new SqlCommand(strCommand,myConnection);
行 70: myConnection.Open();
行 71: addInfo.ExecuteNonQuery();<---------这一句标了红色
行 72: myConnection.Close();
行 73: Response.Redirect("WebForm1.aspx");