日期:2014-05-18  浏览次数:20480 次

URL传值,@id接收问题..
protected   void   Page_Load()
      {
        string   sid=   Request.QueryString[ "id "].ToString();
      }
------------------------------------------
CREATE   PROCEDURE     showrestore
@id   int
as
select   *     from   article     where     id=@id
GO
------------------------------------------
要怎样做让sid=@id那?大哥告诉告诉吧,网上没有搜到..

------解决方案--------------------
SqlParameter p1 = new SqlParameter( "id ",SqlDbType.Nvarchar);
p1.Value = sid;

如果你的命令:SqlCommand cmd = new SqlCommand( "你的存储过程名 ");
cmd.CommandType = CommandType.StoreProcedure;

cmd.Parameters.add(p1);

cmd.ex...