myCommand.Fill(ds, "销售额");
mycommand.Fill(ds,"奖金");
MyDataGrid.DataSource=ds.Tables["销售额"].DefaultView;
MyDataGrid.DataBind();
       or
MyDataGrid.DataSource=ds.Tables["奖金"].DefaultView;
MyDataGrid.DataBind();

解决方案 »

  1.   


    mycommand2.Fill(ds,"奖金");
      

  2.   

    MyDataGrid.DataSource=ds.Tables["销售额"].DefaultView;
    MyDataGrid.DataBind();
    连着
    MyDataGrid.DataSource=ds.Tables["奖金"].DefaultView;
    MyDataGrid.DataBind();
    就可以了。
      

  3.   

    第二个至第n个
    通过ds.Tables["Table1"].....ds.Tables["Table2"]来获得。
    后面的别名没有办法控制。
      

  4.   

    他的问题各位都没有看明白
    他的存储过程是这样写的
    create procedure dbo.myproc
    as
    begin
    use pubs
    select * from dbo.authors
    select * from dbo.jobs
    end
    这样,以前的ado版本都没有办法获得第二个select语句产生的结果集,ado.net可以。因为dataset可以存储多个datatable
    这样在mDa.fill(ds)的时候,就同时fill进去了2个结果集
    第一个可以起个别名,第二个就没有办法了。只能用系统自动生成的Table1,table2,table3.....
    也许有办法都起个别名,但是我没有发现。
      

  5.   

    楼上的兄弟说得对,存储过程我就是这个意思,以前可以用recordset标示出来,比方说set bRs = oRs.NextRecoedSet,现在的除了第一个别名表,后边的只好用
    MyDataGrid.DataSource=ds.Tables[1].DefaultView;
    MyDataGrid.DataBind();
    我如果写
    MyDataGrid.DataSource=ds.Tables["销售额"].DefaultView;
    MyDataGrid.DataBind();

    MyDataGrid.DataSource=ds.Tables[1].DefaultView;
    MyDataGrid.DataBind();
    DataGrid只绑定后一个table,难道一个DataGrid不能绑定两个ds.Tables吗?
    要再写一个DataGrid?
      

  6.   

    webform的datagrid只能绑定在一个dataview上。
    winform可以帮定在多个上
      

  7.   

    默认的datagrid的数据源,是dataset的第一个表的defaultView,所以,应该是不可能同时绑定两个table,除非,你把这两个table的sql组合到一个存储过程中!
    其实,分两次执行存储过程,又怎么样呢?或者,把另一个dataset先放着也可呀!
      

  8.   

    to juqiang
    久仰大名,认识认识?孩子几岁了,回答酱油了吗?  :)