com.ExecuteNonQuery();附近有语法错误 20
protectedvoidButton2_Click(objectsender,EventArgse){stringid=this.TextBox1.ToString()...
protected void Button2_Click(object sender, EventArgs e)
{
string id = this.TextBox1.ToString();
string Pwd = this.TextBox2.ToString();
string Ph = this.TextBox3.ToString();
string card = this.TextBox4.ToString();
string str = "Data Source=.\\SQLEXPRESS;AttachDbFilename=F:\\毕业设计\\App_Data\\Database.mdf;Integrated Security=True;User Instance=True";
SqlConnection Con = new SqlConnection(str);
Con.Open();
string sqlstr = "insert into User(User_id,Password,Phone,ID_card)values('" + id + "','" + Pwd + "','" + Ph + "','" + card + "')";
SqlCommand com = new SqlCommand(sqlstr,Con);
com.ExecuteNonQuery();
Response.Redirect("Default.aspx");
}
} 展开
{
string id = this.TextBox1.ToString();
string Pwd = this.TextBox2.ToString();
string Ph = this.TextBox3.ToString();
string card = this.TextBox4.ToString();
string str = "Data Source=.\\SQLEXPRESS;AttachDbFilename=F:\\毕业设计\\App_Data\\Database.mdf;Integrated Security=True;User Instance=True";
SqlConnection Con = new SqlConnection(str);
Con.Open();
string sqlstr = "insert into User(User_id,Password,Phone,ID_card)values('" + id + "','" + Pwd + "','" + Ph + "','" + card + "')";
SqlCommand com = new SqlCommand(sqlstr,Con);
com.ExecuteNonQuery();
Response.Redirect("Default.aspx");
}
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询