string id = request("id");
SqlConnection myConnection = new SqlConnection("server=chen;database=chen;Trusted_Connection=yes");
            SqlDataAdapter myCommand = new SqlDataAdapter("select id,title,contant from title where id="&id,myConnection);
myConnection.Open;要修改。ID值在另一个页面怎样接收我是自学者上面的程序显示错误

解决方案 »

  1.   

    用另一个页面打开你的页面,同时传过ID值。
    一般用超级链接  http://../GetID.aspx?ID=1111 的形式
    也可以用Session["ID"]=1111的办法实现
      

  2.   

    id=int.prase(Request("id"));
    SqlConnection myConnection = new SqlConnection("server=chen;database=chen;Trusted_Connection=yes");
    SqlDataAdapter myCommand = new SqlDataAdapter("select id,title,contant from title where id="&id,myConnection);
    myConnection.open;
      

  3.   

    SqlDataAdapter myCommand = new SqlDataAdapter("select id,title,contant from title where id="&id,myConnection);上面这句应该把where id="&id改成where id="+id
    如果资料库中id是int型别,还应该先转换。