string sql_filelist = "";
SqlParameter[] cmd_filelist =new SqlParameter[1];
if (Request.QueryString["pdid"]!=null)
{
sql_filelist = "select Pid,Ptitle,Pcontent,Pnum,Psize,Pprice,PDID,PDN,PXID,PXN,dpic,Ppic,Paddtime from ProductList where PDID=@PDID order by Pid desc";
cmd_filelist={ new SqlParameter("@PDID", Request.QueryString["pdid"]) };
}
if (!string.IsNullOrEmpty(Request.QueryString["pxid"]))
{
sql_filelist = "select Pid,Ptitle,Pcontent,Pnum,Psize,Pprice,PDID,PDN,PXID,PXN,dpic,Ppic,Paddtime from ProductList where PxID=@PxID order by Pid desc";
cmd_filelist ={ new SqlParameter("@PxID", Request.QueryString["PxID"]) };
}
if (!string.IsNullOrEmpty(Request.QueryString["pbid"]))
{
sql_filelist = "select Pid,Ptitle,Pcontent,Pnum,Psize,Pprice,PDID,PDN,PXID,PXN,dpic,Ppic,Paddtime from ProductList where PBrandID=@PbID order by Pid desc";
cmd_filelist ={ new SqlParameter("@PbID", Request.QueryString["PbID"]) };
}
这样写老是报多了"}" ,不知道为什么?
是编译报错,还是运行时报错?
@wydycg: 编译器错误消息: CS1525: 无效的表达式项“{”
@wydycg: 那你这样写:
cmd_filelist = new Sqlparameter[]{ new SqlParameter("@PbID", Request.QueryString["PbID"]) };