private void button1_Click(object sender, EventArgs e) { DataList list = new DataList(); DataTable dt = crud.CZwlbmlhmax(); int a3 = Convert.ToInt32(dt.Rows[0]["lhid"].ToString().Substring(2, 10)) + 1; list.lhid = "HL" + a3.ToString().PadLeft(10, '0'); if (txtcpmc.Text == "" || txtcwlx.Text == "" || txtgg.Text == "" || txtkh.Text == "" || txtlhdm.Text == "" || //txtlhid.Text==""|| txtlhlx.Text == "" || txtms.Text == "" || txtpx.Text == "" || txtytms.Text == "" ) { MessageBox.Show("请先输入参数!"); return; } list.cpmc = txtcpmc.Text; list.cwlx = txtcwlx.Text; list.guig = txtgg.Text; list.keh = txtkh.Text; //list.lhid = txtlhid.Text; list.lhdm = txtlhdm.Text; list.lhlx = txtlhlx.Text; list.miaos = txtms.Text; list.paix = txtpx.Text; list.ytms = txtytms.Text; if (checkBox1.Checked) { list.flag = "Y"; } else { list.flag = "N"; } if (crud.Addwlbm(list) == "success") { MessageBox.Show("添加成功!"); databind(); } }