仿存储过程的令一种方式

SqlDbType[] lx = new SqlDbType[11];
                lx[0] = SqlDbType.NVarChar;
                lx[1] = SqlDbType.NVarChar;
                lx[2] = SqlDbType.NVarChar;
                lx[3] = SqlDbType.NVarChar;
                lx[4] = SqlDbType.NVarChar;
                lx[5] = SqlDbType.NVarChar;
                lx[6] = SqlDbType.NVarChar;
                lx[7] = SqlDbType.NVarChar;
                lx[8] = SqlDbType.NVarChar;
                lx[9] = SqlDbType.NVarChar;
                lx[10] = SqlDbType.NVarChar;
                string[,] strs = new string[11, 2];
                strs[0, 0] = "@ldrq"; strs[0, 1] = dtpldrq.Value.ToString();
                strs[1, 0] = "@gys"; strs[1, 1] = cbogys.SelectedValue.ToString();
                 strs[3, 0] = "@spbh"; strs[3, 1] = cbospbh.Text;
                strs[4, 0] = "@spmc"; strs[4, 1] = txtspmc.Text;
                strs[5, 0] = "@dw"; strs[5, 1] = txtdw.Text;
                strs[6, 0] = "@sl"; strs[6, 1] = txtsl.Text;
                strs[7, 0] = "@jj"; strs[7, 1] = txtjj.Text;
                strs[8, 0] = "@yfje"; strs[8, 1] = txtyfje.Text;
                strs[9, 0] = "@sfje"; strs[9, 1] = txtsfje.Text;
                strs[10, 0] = "@djbh"; strs[10, 1] = lbldjbh.Text;
   String sql = "insert jhb values(@djbh,@ldrq,@gys,@jsr,@spbh,@spmc,@dw,@sl,@jj,@yfje,@yfje,0)";    //带?参?数簓的?增?加ó
                if (dbclass.ExecuteSql(sql, strs, lx))
                {
                    MessageBox.Show("增?加ó成é功|", "提?示?");
                    showdb();
                    qk();
                    btndy.Enabled = true;
                    lbldjbh.Text = getdate();
                    dtpldrq.Enabled = cbogys.Enabled = txtjsr.Enabled = txtyfje.Enabled = txtsfje.Enabled = cbospbh.Enabled = txtspmc.Enabled = txtdw.Enabled = txtsl.Enabled = txtjj.Enabled = false;
                }

                else
                {
                    MessageBox.Show("失骸?败悒?, "提?示?");
                }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值