http://dotnet.aspx.cc/ShowDetail.aspx?id=149E5DD7-3B32-461e-ACC6-51D1652E6746

解决方案 »

  1.   

    孟老大:
    我就是根据你这个做的,只不过把VB改成C#了Command.Fill(ds);为什么会提示:在 SQL 语句结尾之后找到字符????????????
      

  2.   

    string strsql="Select * from DaLei order by Pu; Select * from XiaoLei";
    OleDbDataAdapter Command=new OleDbDataAdapter(strsql,MyConnection);
    DataSet ds=new DataSet();
    改成这样了,还是出错
    错误提示一样:在 SQL 语句结尾之后找到字符Command.Fill(ds);
    MyConnection.Close();
    ds.Tables[0].TableName="DaLei";
    ds.Tables[1].TableName="XiaoLei";
    DataColumn Parent=ds.Tables["DaLei"].Columns["DaLeiMing"];
    DataColumn Child=ds.Tables["XiaoLei"].Columns["XiaoLeiMing"];
    DataRelation OrderRelation=new DataRelation("OrderRelation",Parent,Child,false);
    ds.Relations.Add(OrderRelation);
    DataGrid1.DataSource=ds.Tables["DaLei"].DefaultView;
    DataGrid1.DataBind();
      

  3.   

    string strsql="Select * from DaLei order by Pu; Select * from XiaoLei";
    这个不行!干嘛写2个SQL语句? 错误信息的意思是说在结束符“;”号还有东东
      

  4.   

    net_lover(孟子E章)的文章不错!
      

  5.   

    问题很显然,出在SQL语句上!多试一下.
      

  6.   

    方法一:
    string strsql="Select * from DaLei order by Pu";
    string str="Select * from XiaoLei";
    OleDbDataAdapter Command=new OleDbDataAdapter(strsql,MyConnection);
    OleDbDataAdapter Command1=new OleDbDataAdapter(str,MyConnection);
    DataSet ds=new DataSet();
    Command.Fill(ds);
    Command1.Fill(ds);
      

  7.   

    二:
    string strsql="Select * from DaLei a ,XiaoLei b order by Pu";
      

  8.   

    by pu
    =========>
    by a.pu
      

  9.   

    你把分号去掉试试。
    数据库中两个SQL之间都不用分号的。