高手帮忙看下,asp.net写的.数据库为什么不能更新?
protected void Submit_Click(object sender, EventArgs e){
SqlConnection cn = new SqlConnection("server=localhost ;uid=sa;pwd=sa;database=HotelManagement");
string n = "select top (1) UserID from Login order by UserID desc";
SqlCommand cmd = new SqlCommand(n, cn);
cn.Open();
SqlDataReader sdr = cmd.ExecuteReader();
sdr.Read();
int a = (int)sdr["UserID"];
int b;
b = a + 1;
string s = "";
if (RadioButton1.Checked)
s = "男";
else if (RadioButton2.Checked)
s = "女";
SqlCommand cm = new SqlCommand("insert into Customers(UserID,CName,CAge,CSex,CPhone) values('" + b + "','" + this.TextBox1.Text + "','" + this.TextBox4.Text + "','" + s + "','" + this.TextBox8.Text + "'", cn);
SqlDataAdapter da = new SqlDataAdapter(cm);
}