DataSet ds = new DataSet();
string strconn=\\连接串
string strsql = "select * from table1;select * from table2;"
OleDbDataAdapter da = new OleDbDataAdapter(strsql,strconn);
da.fill(ds);
请问大家为什么会报SQL语句结尾之后找到字符的错误码?这样写有错误码吗?

解决方案 »

  1.   

    string strsql = "select * from table1;select * from table2;" ;
      

  2.   

    string strsql = "select * from table1;select * from table2;" 不能这样写一个一个select,不能一起,不然就用字段连起来
      

  3.   

    sql语句不能这么写啊
    不能有两个查询语句  只能是用字段连起来查询
      

  4.   

    不能这样写应该怎样写呢?我是在ADO.NET2.0技术内幕这本书上看到的,书上都是这样写的,我觉得
    这样写很简洁,就试了一下,报错......
    应该是哪里出了问题吧,是不是可以多条select语句一起
    fill到dataset中的.
      

  5.   

    这样写是没有错误的,只是书上用的是sqlserver数据库,而我用的是access
    access数据库不支持多语句查询!要是换成sqlserver或是oracle就可以
    谢谢大家,这样的写法是可以地!大家共同学习吧!
      

  6.   

    string strsql = @"select * from table1;select * from table2;" ;
      

  7.   

    结论是这样的。估计你是用access。 Access 不支持两个语句一起查询,也就是说 提示说的是:select * from table1;select * from table2;
    红色的是不符合要求的符号。SQL7.0, 2000,2005 ,2008支持两个语句一起查询
      

  8.   

    string strsql = "select * from table1 GO select * from table2 GO"; 
      

  9.   


    string strsql = "select * from table1;select * from table2;" 后面加;sql语句这样写没问题
    这样返回结果集
    我知道用sqldatareader可以
    没试过sqldataadapter