CollectTableData(string no){SQL = "select * from 表1 where 编号 = 8" ;//可以执行SQL = "select * from 表1 where 编号 = " + no ; //说等号附近有错误??
}

解决方案 »

  1.   

    为什么CollectTableData("8")报错=附近有错误??
      

  2.   

    SQL = "select * from 表1 where 编号 = " + no.ToString() ;
      

  3.   

    SQL = "select * from 表1 where 编号 = '" + no +"'"; 
      

  4.   

    CollectTableData(int no)
    SQL = "select * from 表1 where 编号 = " + no.ToString();试试~~~~你的其他的代码呢?
    可能是别的地方的问题
      

  5.   

    你的编号是什么类型的?string还是int
      

  6.   

    no 此时可能为空,所以报错。可以按照 saintqiqi(钻石星辰) 的方法来做。
      

  7.   

    从出错看出你的编号字段是int型的啊,改为SQL = "select * from 表1 where 编号 = '" + no +"'"; 就可以了。
      

  8.   

    问题是这样的:原来是子页面没有捕捉到参数主页面PostNew.aspx?no=传递进来的参数,此页面里面还有一个按钮,<INPUT style="WIDTH: 88px; CURSOR: hand; HEIGHT: 24px" onclick="top.detail.location.href='BaseInformation.aspx'"type="button" value="基本信息">
    我如何将这个按钮的'BaseInformation.aspx'链接写成'BaseInformation.aspx?no=传递进来的参数'???
      

  9.   

    CollectTableData(string no){SQL = "select * from 表1 where 表1.编号 = '8'" ;SQL = "select * from 表1 where 表1.编号 = '" + no +"'"; 
    }已定义了no为string,所以就不用no.Tostring();
      

  10.   


    你用SQL = "select * from 表1 where 编号 = " + no.ToString() ;
    或者SQL = "select * from 表1 where 编号 = '"+ no + "'";