protected void Button1_Click(object sender, EventArgs e) {
string str = "Data Source=(local);Database=laomo;User ID=sa;Pwd=sa"; SqlConnection con = new SqlConnection(str); con.Open();//awarddateid, 没有设置 string peo = "insert into [name](name,sex,title,id,nation,polstatus,education,awardnameid,placeid,workplaceid) values = ('" + TextBox1.Text.ToString() + "','" + TextBox4.Text.ToString() + "','" + TextBox2.Text.ToString() + "','" + TextBox3.Text.ToString() + "','" + TextBox5.Text.ToString() + "','" + DropDownList1.SelectedValue.ToString() + "', '" + DropDownList6.SelectedValue.ToString() + "','" + DropDownList2.SelectedValue.ToString() + "','" + DropDownList4.SelectedValue.ToString() + "','" + DropDownList3.SelectedValue.ToString() + "')"; SqlCommand str1 = new SqlCommand(peo, con); str1.ExecuteNonQuery(); con.Close();
}
求大神解决 DropDownList4.SelectedValue 后面要不要加 .ToString() 这个的作用是什么?
繁花不似锦
慕容森
相关分类