Click here to Skip to main content
15,900,431 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
Please provide some example
Thanks
Posted
Comments
Rajesh Anuhya 27-Dec-11 6:36am    
No effort
Vijay Kr Sharma 27-Dec-11 6:38am    
What Do You Mean

 
Share this answer
 
Comments
Vijay Kr Sharma 27-Dec-11 6:29am    
Thanks Sir
uspatel 27-Dec-11 6:33am    
http://www.dotnetspider.com/forum/70580-How-can-I-fill-multiple-DataTables-DataSet.aspx
check it also.
you can use tables inside dataset like this..

C#
foreach(DataTable dt in ds.Tables)
{
    Console.WriteLine(dt.Rows[0][1].ToString());
}


check here for more..

Dataset[^]
Datatables in dataset[^]
multiple tables into dataset[^]

hope it helps..
 
Share this answer
 
Comments
Vijay Kr Sharma 27-Dec-11 6:35am    
Thanks
Try this,

SQL
create procedure spDataset
as
begin
select * from tblCountry
select * from tblCity
end

In CS page


C#
protected void Page_Load(object sender, EventArgs e)
    {
        connection();
        cmd.CommandType=CommandType.StoredProcedure;
        cmd = new SqlCommand("spDataset", conn);
        da = new SqlDataAdapter(cmd);
        da.Fill(ds);
        GridView1.DataSource = ds.Tables[0];// For first select query(table) in Stored procedure, that is select * from tblCountry
        GridView1.DataBind();
        GridView2.DataSource = ds.Tables[1];// For first select query(table) in Stored procedure, that is select * from tblCity
        GridView2.DataBind();
    }
 
Share this answer
 
Comments
Vijay Kr Sharma 27-Dec-11 6:42am    
Actually I am trying to store data coming from two tables In A single Dataset (In Two Different Table) If you have solution then please.
Shobana16 27-Dec-11 6:45am    
Do you want join condition?
Vijay Kr Sharma 27-Dec-11 6:46am    
No Actually I did not analyzed your code it solved my problem thanks a lot
Shobana16 27-Dec-11 6:49am    
ok.. If you get solution mark it as answer..
SQL
create procedure spDataset
as
begin
select * from tblCountry
select * from tblCity
end
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900