GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Microsoft  >  Ado.NET
Go To First  |  Previous Question  |  Next Question 
 Ado.NET  |  Question 11 of 31    Print  
How can we load multiple tables in to Dataset?

  
Total Answers and Comments: 7 Last Update: June 09, 2007     Asked by: tallam ravikanth 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: sahu
 
Hi All,


Ans:

By Using SqlAdataAdapter Fill Method

DataSet ds=new DataSet();

SqlDataAdapter dap=new SqlDataAdapter(Select
* from <tablename>,<connection1>);

dap.Fill(ds,"TableOne");

SqlDataAdapter dap1=new SqlDataAdapter(Select
* from <tablename>,<connection1>);

dap1.Fill(ds,"tableTwo");



Above answer was rated as good by the following members:
prabhukumar.r, PawanKum
July 12, 2006 02:49:05   #1  
PratIndia        

RE: How can we load multiple tables in to Dataset?

We can do this by using DataAdapter's fill Method.Syntax for This is

DataSet ds new DataSet();

SqlDataAdapter dap new SqlDataAdapter(<query1> <connection>);

dap.Fill(ds <TableName> );

SqlDataAdapter dap1 new SqlDataAdapter(<query2> <connection>);

dap1.Fill(ds <TableName1> );


 
Is this answer useful? Yes | No
September 28, 2006 07:41:40   #2  
CAR        

RE: How can we load multiple tables in to Dataset?
By using data relation object we can load multiple tables
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
December 11, 2006 13:19:18   #3  
nraj71 Member Since: December 2006   Contribution: 2    

RE: How can we load multiple tables in to Dataset?

Write the select queries required in fill statement.

e.g.

Adp.Fill( Select * from Table1;Select * from Table2;Select * from Table3 DS)

This statement wil generate Dataset with 3 datatables.


 
Is this answer useful? Yes | No
January 04, 2007 13:29:00   #4  
Mob: +91 9849255958        

RE: How can we load multiple tables in to Dataset?

Hi

Actually ....u have to write multiple select statements while creating a dataadapter not in fill() method.

ex: SqlDataadapter da new SqlDataadapter( select statement1; select statement2; ..... connection);


 
Is this answer useful? Yes | No
January 04, 2007 13:32:12   #5  
Mob: +91 9849255958        

RE: How can we load multiple tables in to Dataset?

To create multiple datatables in a dataset u have to write multiple select statements........

each select statement creats a datatable in dataset...u can write ; (semicolon) seperated select statements in a command text or u can write as stored procedure ....


 
Is this answer useful? Yes | No
March 29, 2007 12:09:43   #6  
sahu Member Since: December 2005   Contribution: 323    

RE: How can we load multiple tables in to Dataset?
Hi All


Ans:

By Using SqlAdataAdapter Fill Method

DataSet ds new DataSet();

SqlDataAdapter dap new SqlDataAdapter(Select
* from <tablename> <connection1>);

dap.Fill(ds "TableOne");

SqlDataAdapter dap1 new SqlDataAdapter(Select
* from <tablename> <connection1>);

dap1.Fill(ds "tableTwo");


 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
June 09, 2007 05:53:56   #7  
karthik        

RE: How can we load multiple tables in to Dataset?
by using the data view method we can do it
 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 1Overall Rating: -1    


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape