本帖最后由 lld31 于 2012-06-06 22:41:05 编辑

解决方案 »

  1.   

    string strSql = "select * from YG301 where (Name ='"+ listStr + "')";=============》string strSql = "select * from YG301 where [Name] ='"+ listStr + "'";
      

  2.   


    da.Fill(ds); 这个地方还是提示缺个参数!
      

  3.   

    1、参数化引用
    http://bailong139.blog.163.com/blog/static/20723810020125441529306/
    不知道是不是你要的东西
    2、DataSet ds = new DataSet(YG301);或许这样吧,数据集要与表联系
      

  4.   

    DataSet 换 DataTable 试试
    DataTable dtbl = new DataTable();
    da.Fill(dtbl);
      

  5.   

    da.Fill(ds,YG301);
    myCon.Close();
      

  6.   

    string strSql = "select * from YG301 where (Name ='"+ listStr + "')";
    这里listStr的内容是什么? 你跟踪过最后生成的strSql吗?这种拼接很容易造成注入漏洞。
      

  7.   

    dataset是一个数据集,你执行一次查询出来的肯定是一个表 所以要dataadapter只能fill一个datatable,这样
    datatable dt=new datatable();
    da.fill(dt);
    即可