我用的是asp.net和c#
show.aspx的时候,为什么
........(省略) string showid=Request.Params["id"];
........(省略)//String sql="select * from  webdata where taxis="+showid;//错误的地方运算符“&”无法应用于“string”和“string”类型的操作数

SqlDataAdapter Cmd_showcontent=new SqlDataAdapter(sql_showcontent,Con);
Cmd_showcontent.Fill(ds, "showcontent");
showcontent.DataSource = ds.Tables["showcontent"].DefaultView;
            showcontent.DataBind(); 并且提示showcontent不存在,但我在显示页面里面已经定义的
我很罗嗦了一点,拜托垃!!!!!!!

解决方案 »

  1.   

    感觉你的SQL语句有问题,用这个看看String sql="select * from  webdata where taxis=" + showid +"";
      

  2.   

    谢谢楼上的老兄:
    但是又出现了一个错误:拜托拜托看看啦!
    异常详细信息: System.Data.SqlClient.SqlException: 第 1 行: '=' 附近有语法错误。源错误: 
    行 43: 
    行 44:  SqlDataAdapter Cmd_showcontent=new SqlDataAdapter(sql_showcontent,Con);
    行 45:  Cmd_showcontent.Fill(ds, "showcontent");
    行 46:  showcontent.DataSource = ds.Tables["showcontent"].DefaultView;
    行 47:             showcontent.DataBind();
     
      

  3.   

    string showid=Request.QueryString["id"];换一下试试
    呵呵
    单步跟踪以下F11
      

  4.   

    SQL语句错了.这样就行了.String sql="select * from  webdata where taxis='"showid +"'";
      

  5.   

    String sql="select * from  webdata where taxis="+showidString sql="select * from  webdata where taxis='"showid +"'";记住C#里面的字符串定义是string小写哦。或者
    new String(sql);