473,814 Members | 3,131 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datasets

Can one dataset be directly populated with tables from different sources?

Example:
There are 3 .mdb files, with the same schema, and I want 2 tables from each
file. Is there a way I can just create one dataset and put all the tables
into that dataset? (versus creating a dataset for each .mdb then merging the
datasets)
Thanks,
~ Yuki
Nov 18 '05 #1
4 2941
Yes, you can. Just pass the same data set object to all the Fill() method
calls of the data adapter, perhaps with a different table name each time.

"Yuki" <Yu**@discussio ns.microsoft.co m> wrote in message
news:7B******** *************** ***********@mic rosoft.com...
Can one dataset be directly populated with tables from different sources?

Example:
There are 3 .mdb files, with the same schema, and I want 2 tables from each
file. Is there a way I can just create one dataset and put all the tables
into that dataset? (versus creating a dataset for each .mdb then merging
the
datasets)
Thanks,
~ Yuki
Nov 18 '05 #2
Let's see if I understand...

The Fill() method is called through a table adapter or data adapter and
passed a dataset, which it will fill. Right now I have 3 different table
adapters, because I have 3 separate .mdb files, so the code looks like:

this.TableAdapt er.Fill(this.Da taSet.table1); // from
a.mdb
this.TableAdapt er1.Fill(this.D ataSet2.table1) ; // from b.mdb
this.TableAdapt er2.Fill(this.D ataSet3.table1) ; // from c.mdb

If I were to change the part that says DataSet* to just DataSet, in the Fill
method, the complier gives me errors. I'm assuming this is because the table
adapters only like their personal datasets, because of possible schema issues?

Would I need to create a new dataset and define a schema? Or is the issue
with the table adapters?
Thanks,
~ Yuki


"Siva M" wrote:
Yes, you can. Just pass the same data set object to all the Fill() method
calls of the data adapter, perhaps with a different table name each time.

"Yuki" <Yu**@discussio ns.microsoft.co m> wrote in message
news:7B******** *************** ***********@mic rosoft.com...
Can one dataset be directly populated with tables from different sources?

Example:
There are 3 .mdb files, with the same schema, and I want 2 tables from each
file. Is there a way I can just create one dataset and put all the tables
into that dataset? (versus creating a dataset for each .mdb then merging
the
datasets)
Thanks,
~ Yuki

Nov 18 '05 #3
How about something like this.

using (SqlConnection conn = new SqlConnection(d sn))
{
using (SqlCommand cmd = new SqlCommand())
{
cmd.Connection = conn;

cmd.CommandText = "Select * from database1file"

using (SqlDataAdapter da = new SqlDataAdapter( ))
{
using (DataSet ds = new DataSet())
{

da.SelectComman d = cmd;
da.Fill(ds, "1stTable") ;

cmd.CommandText = "Select * from database2file"
da.SelectComman d = cmd;
da.Fill(ds, "2ndTables" );
}
}
}
}
}


"Yuki" <Yu**@discussio ns.microsoft.co m> wrote in message
news:33******** *************** ***********@mic rosoft.com...
Let's see if I understand...

The Fill() method is called through a table adapter or data adapter and
passed a dataset, which it will fill. Right now I have 3 different table
adapters, because I have 3 separate .mdb files, so the code looks like:

this.TableAdapt er.Fill(this.Da taSet.table1); // from
a.mdb
this.TableAdapt er1.Fill(this.D ataSet2.table1) ; // from
b.mdb
this.TableAdapt er2.Fill(this.D ataSet3.table1) ; // from
c.mdb

If I were to change the part that says DataSet* to just DataSet, in the
Fill
method, the complier gives me errors. I'm assuming this is because the
table
adapters only like their personal datasets, because of possible schema
issues?

Would I need to create a new dataset and define a schema? Or is the issue
with the table adapters?
Thanks,
~ Yuki


"Siva M" wrote:
Yes, you can. Just pass the same data set object to all the Fill() method
calls of the data adapter, perhaps with a different table name each time.

"Yuki" <Yu**@discussio ns.microsoft.co m> wrote in message
news:7B******** *************** ***********@mic rosoft.com...
Can one dataset be directly populated with tables from different sources?

Example:
There are 3 .mdb files, with the same schema, and I want 2 tables from
each
file. Is there a way I can just create one dataset and put all the
tables
into that dataset? (versus creating a dataset for each .mdb then merging
the
datasets)
Thanks,
~ Yuki

Nov 18 '05 #4
Did you try Mel's code?

"Yuki" <Yu**@discussio ns.microsoft.co m> wrote in message
news:33******** *************** ***********@mic rosoft.com...
Let's see if I understand...

The Fill() method is called through a table adapter or data adapter and
passed a dataset, which it will fill. Right now I have 3 different table
adapters, because I have 3 separate .mdb files, so the code looks like:

this.TableAdapt er.Fill(this.Da taSet.table1); // from
a.mdb
this.TableAdapt er1.Fill(this.D ataSet2.table1) ; // from
b.mdb
this.TableAdapt er2.Fill(this.D ataSet3.table1) ; // from
c.mdb

If I were to change the part that says DataSet* to just DataSet, in the Fill
method, the complier gives me errors. I'm assuming this is because the
table
adapters only like their personal datasets, because of possible schema
issues?

Would I need to create a new dataset and define a schema? Or is the issue
with the table adapters?
Thanks,
~ Yuki


"Siva M" wrote:
Yes, you can. Just pass the same data set object to all the Fill() method
calls of the data adapter, perhaps with a different table name each time.

"Yuki" <Yu**@discussio ns.microsoft.co m> wrote in message
news:7B******** *************** ***********@mic rosoft.com...
Can one dataset be directly populated with tables from different sources?

Example:
There are 3 .mdb files, with the same schema, and I want 2 tables from
each
file. Is there a way I can just create one dataset and put all the tables
into that dataset? (versus creating a dataset for each .mdb then merging
the
datasets)
Thanks,
~ Yuki

Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2694
by: William Ryan | last post by:
At the risk of sounding like a Big 5 consultant, "It depends". 1) Strongly typed datasets rock, they are faster than untyped, use intellisense... but your reason for wanting to use them is important. I use them every day of my life, but I also don't use them every day of my life and there are reasons for both. 2) How much of your process is dependent on reads vs.
4
1738
by: Alpha | last post by:
I have a small Window application and through out the different forms I create a different dataset. At the begining I used the Tools to drag and drop the SqlDataAdapter, connection and dataset objects to the frist few forms but then later I removed those and created these objects in my code. I now see 3 datasets in the Solution Explorer panel part but not all the datasets that I have in my codes. Are these 3 datasets leftover from the...
9
2918
by: GaryDean | last post by:
We have been noticing that questions on vs.2005/2.0 don't appear to get much in answers so I'm reposting some questions posted by some of the programmers here in our organization that never got answered... There are articles on the new TableAdapters where it says that a key new advantage is that a single TableAdapter, which can have multiple queries, can be used on multiple forms. Now that was in an article on using TableAdapters with...
16
1939
by: Luqman | last post by:
Is it recommended to use datasets in ASP.Net 2.0 / VS.Net 2005 ? Best Regards, Luqman
4
9924
by: Ronald S. Cook | last post by:
I've always used untyped datasets. In a Microsoft course, it walks through creating typed datasets and harps on the benefits. It has you drag all these things around ..wizard, wizard, wizard... code gen, code gen, code gen. What's at the end looks slick, but then there's a ton of generated code that I'm going to have to maintain now. I.e. I like typing things myself (don't like wizards) so I can know exactly what I've done.
25
2782
by: Penelope Dramas | last post by:
Hello, I'm in a front of very serious .net redesign/rewrite of an old VB6 application. I had been asked to make it .NET 2.0 and would like to ask couple of questions regarding data access as this application is heavily data-centric around MSDE database. Would it be better to use custom business objects or extend
2
1372
by: S.Tedeschi | last post by:
Hi all gurus. I'm trying to switch to VS 2005, from VS 2003. I've an ASP.NET 1.1 app heavily relying on StronglyTyped DataSets, with lots of FindByKey..., dataSet.Tablename, and similar methods. Converting to ASP.NET 2.0 leaves dataSets' classes unconverted, as stated by M$; what's worse, I'm not able to use converted dataSets, nor new ones, but just non- typed dataSets declared directly in pages (or code-behind), and so I'm not allowed...
0
1223
by: S.Tedeschi | last post by:
Hi all; as posted some days ago, I'm converting an on-line app; I used to heavily rely on strongly-typed DataSets directly dropped onto pages, and so viewed by code(-behind) as well. In the next two weeks I discovered that such objects are no more directly usable in pages, namely in DataGrid which don't see them any more. Even if rebuilt in Component Designer, and so visible in code, DataSets are invisible in Page Designer, so now it's...
12
3606
by: BillE | last post by:
I'm trying to decide if it is better to use typed datasets or business objects, so I would appreciate any thoughts from someone with more experience. When I use a business object to populate a gridview, for example, I loop through a datareader, populating an array list with instances of a custom class in the middle tier, and then send the array list up to the presentation layer and bind the gridview to it. If I use a typed dataset, I...
9
1945
by: gardnern | last post by:
We have X number of data sets, of Y length each. For example... Small, Medium, Large and Red, Green, Blue, Yellow We need to generate a list of all possibilities Small Red
0
9609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10408
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10426
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10141
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9225
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7686
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5707
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3030
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.