#region 带参数添加
//首先定义参数类型
SqlDbType[] lx = new SqlDbType[11];//表中要添加的需要添写数据的字段有9个
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] = "@N_Lanmu"; strs[0, 1] = ClassID.ToString();
strs[1, 0] = "@N_title"; strs[1, 1] = txtTitle.Text.Trim();
strs[2, 0] = "@N_Publisher"; strs[2, 1] = txtfbr.Text.Trim();
strs[3, 0] = "@N_Department"; strs[3, 1] = txtbm.Text.Trim();
strs[4, 0] = "@N_Content"; strs[4, 1] = ASPxHtmlEditor1.Html;
strs[5, 0] = "@N_CreateDate"; strs[5, 1] = fubutime.Text.Trim();
strs[6, 0] = "@N_Click"; strs[6, 1] = Flag.ToString();
strs[7, 0] = "@N_Top"; strs[7, 1] = ZD.ToString();
strs[8, 0] = "@N_PX"; strs[8, 1] = TextBox2.Text.Trim();//排序
strs[9, 0] = "@Img_url"; strs[9, 1] = picurl.Text.Trim();
strs[10, 0] = "@Img_visible"; strs[10, 1] = xstp.ToString();
//定义INSERT语句
string strInsert = "insert into NewsT values(@N_Lanmu,@N_title,@N_Publisher,@N_Department,@N_Content,@N_CreateDate,@N_Click,@N_Top,@N_PX,@Img_url,@Img_visible)";
//执行语句
if (db.ExecuteSql(strInsert, strs, lx))
{
Response.Write("");//转页2种方法
}
els
{
Response.Write("");
}
#endregion