SqlDbType[] lx = new SqlDbType[12];//表中要添加的需要添写数据的字段有6个
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;
lx[11] = SqlDbType.NVarChar;
//其次二维数组,即参数名与参数值
string[,] strs = new string[12, 2];
strs[0, 0] = "@N_cmbkh"; strs[0, 1] = cmbkh.Text.Trim();
strs[1, 0] = "@N_txtxm"; strs[1, 1] = txtxm.Text.Trim();//下拉列表框内容
strs[2, 0] = "@N_txtpic"; strs[2, 1] = txtxm.Text.Trim()+".jpg";
strs[3, 0] = "@N_rzlx"; strs[3, 1] = rzlx.ToString();
strs[4, 0] = "@N_rzxm"; strs[4, 1] = rzxm.ToString();
strs[5, 0] = "@N_YSJE"; strs[5, 1] = YSJE.ToString();
strs[6, 0] = "@N_txtssje"; strs[6, 1] = txtssje.Text.Trim();
strs[7, 0] = "@N_txtqkje"; strs[7, 1] = txtqkje.Text.Trim();//下拉列表框内容
strs[8, 0] = "@N_txtzl"; strs[8, 1] = txtzl.Text.Trim();
strs[9, 0] = "@N_txtczy"; strs[9, 1] = txtczy.Text.Trim();
strs[10, 0] = "@N_tb"; strs[10, 1] = tb.ToString();
strs[11, 0] = "@N_txtRemarks"; strs[11, 1] = txtRemarks.Text.Trim();
string str = "insert into dbo.JoinT values(@N_cmbkh,@N_txtxm,@N_txtpic,@N_rzlx,@N_rzxm,@N_YSJE,@N_txtssje,@N_txtqkje,@N_txtzl,default,@N_txtczy,@N_tb,@N_txtRemarks)";
db.ExecuteSql(str, strs, lx)
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余1页未读,立即下载