Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello Friends,,,,

Can we use different databases or datasources in DATASET....?

Please anyone with example
Posted
Comments
choudhary.sumit 5-Dec-12 1:46am    
explain "diffrent"?do u mean more then one datasourse?
PRAKASH_N 5-Dec-12 1:58am    
yes

Yes you can use different databases as well

See this solution or follow the link:

http://forums.asp.net/p/949947/1155679.aspx/1?Re+Using+two+different+databases+with+a+dataset+[^]
OR
Re: Using two different databases with a dataset?
Dec 30, 2005 09:39 PM|LINK

I just found the answer and it is, YES you can fill a dataset with data from different databases. The following points need to be kept in mind if you are using multiple connections with a single dataset:

Each data adapter needs to be for a single connection.
You can fill a dataset from multiple databases, but while filling a table always use a new data adapter and a new command object for each database.
Give a name to the table you are filling. ex. dataAdapter1.Fill(dataSet1, "table1").
If you recycle the previous data adapter and command objects from the database1 connection to database2 connection, then you cannot populate multiple databases into a single dataset. That is what I noticed while trying to use multiple databases in a dataset.
 
Share this answer
 
hi,

you can use one database or datasource per one dataset. if you are using more than one dataset/datatable then you can use different database or datasource .
 
Share this answer
 
No a dataset is based on a collection of table, generally loaded from a connection to the database, this will allow only one database in a dataset

Yes if you take 2 datasets loaded from different databases and manually move the table into 1 dataset then you have tables from the different databases!
 
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