protected void btnAdd_Click(object sender, EventArgs e) { strtDsznfmjlb tmp = new strtDsznfmjlb(); tmp.name = txtName.Text; tmp.sex = Convert.ToInt16(dplSex.SelectedIndex); tmp.birthday = Convert.ToDateTime(txtBirthday.Text); tmp.childbirthday = Convert.ToDateTime(txtChildBirthday.Text); tmp.childsex = Convert.ToInt16(dplChildSex.SelectedIndex); tmp.familycode = txtfamilyCode.Text; tmp.isoldinsure = Convert.ToInt16(chkIsOldInsure.Checked); //是否参加养老保险补贴(0 未 1 参加) tmp.locationcode = txtLocationCode.Text; tmp.lushi = Convert.ToInt16(chkLushi.Checked ? 1 : 0); tmp.lushidate = Convert.ToDateTime(txtLushiDate.Text); tmp.namelocation = txtLocation.Text; tmp.onechildcardcode = txtOneChildCardCode.Text; tmp.paydate = Convert.ToDateTime(txtPaydate.Text); tmp.paynum = Convert.ToDouble(txtPaynum.Text); tmp.poldcode = txtPoldcode.Text; tmp.poname = txtPoName.Text; tmp.shenghe = Convert.ToInt16(dplShenghe.SelectedIndex); tmp.shenghedate = Convert.ToDateTime(txtShenghedate.Text); tmp.shenghenoreason = txtShengheNoReason.Text; tmp.shengheren = txtShengheRen.Text; tmp.unitname = txtUnitName.Text; tmp.unitxingzhi = Convert.ToInt16(dplUnitXingzhi.SelectedIndex); tmp.username = Session["UserName"].ToString(); tmp.inputdate = DateTime.Now; string strSQL = Table_Dsznfmjlb.GetSQL_Insert(tmp); rwDB db = new rwDB(); db.ExcuteSQL(strSQL); }
public static string GetSQL_Insert(strtDsznfmjlb tmp) { string strSQL; strSQL = string.Format("INSERT INTO dsznfmjlb([name],[sex],[birthday],[namelocation] ,[locationcode],[poname],[poldcode] ,[onechildcardcode] ,[childbirthday],[childsex]" + ",[paydate],[paynum],[isoldinsure],[lushi],[lushidate],[shenghe],[shengheren],[shenghedate],[shenghenoreason],[familycode],[unitname],[unitxingzhi]" + ",[username],[inputdate])" + "VALUES" + "('" + tmp.name + "'," + tmp.sex + ",'" + tmp.birthday.ToString("yyyy-MM-dd HH:mm:ss") + "','" + tmp.namelocation + "','" + tmp.locationcode + "','" + tmp.poname + "','" + tmp.poldcode + "','" + tmp.onechildcardcode + "','" + tmp.childbirthday.ToString("yyyy-MM-dd HH:mm:ss") + "'," + tmp.childsex + ",'" + tmp.paydate.ToString("yyyy-MM-dd HH:mm:ss") + "'," + tmp.paynum + "," + tmp.isoldinsure + "," + tmp.lushi + ",'" + tmp.lushidate.ToString("yyyy-MM-dd HH:mm:ss") + "'," + tmp.shenghe + ",'" + tmp.shengheren + "','" + tmp.shenghedate.ToString("yyyy-MM-dd HH:mm:ss") + "','" + tmp.shenghenoreason + "','" + tmp.familycode + "','" + tmp.unitname + "'," + tmp.unitxingzhi + ",'" + tmp.username + "','" + tmp.inputdate + "')"); return strSQL; }