日期:2014-05-17 浏览次数:20461 次
protected void btnSubmit_Click(object sender, EventArgs e)
{
string constr = System.Configuration.ConfigurationManager.ConnectionStrings["DormitoryMSConnectionString"].ToString();
string sqlstr = "insert into 财产报修表 values('" + txtUserConnect.Text + "','" + txtUSerRoom.Text + "','";
sqlstr += ddlUserDormitory.SelectedItem.Text + "','" +txtUserTime.Text + "','" + txtUserRepair.Text + "','";
sqlstr += txtUserRepairDetail.Text + "','" + Request.Cookies["UNum"].Value + "')";
txtUserRepairDetail.Text = sqlstr;
Selection st = new Selection();
st.insertTable(constr, sqlstr);
}
public void insertTable(string constr, string sqlstr)
{
SqlConnection con = new SqlConnection(constr);
con.Open();
SqlCommand com = new SqlCommand(sqlstr, con);
com.ExecuteNonQuery();
con.Close();
}