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 4 2913
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**@discussions.microsoft.com> wrote in message
news:7B**********************************@microsof t.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
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.TableAdapter.Fill(this.DataSet.table1); // from
a.mdb
this.TableAdapter1.Fill(this.DataSet2.table1); // from b.mdb
this.TableAdapter2.Fill(this.DataSet3.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**@discussions.microsoft.com> wrote in message news:7B**********************************@microsof t.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
How about something like this.
using (SqlConnection conn = new SqlConnection(dsn))
{
using (SqlCommand cmd = new SqlCommand())
{
cmd.Connection = conn;
cmd.CommandText = "Select * from database1file"
using (SqlDataAdapter da = new SqlDataAdapter())
{
using (DataSet ds = new DataSet())
{
da.SelectCommand = cmd;
da.Fill(ds, "1stTable");
cmd.CommandText = "Select * from database2file"
da.SelectCommand = cmd;
da.Fill(ds, "2ndTables");
}
}
}
}
}
"Yuki" <Yu**@discussions.microsoft.com> wrote in message
news:33**********************************@microsof t.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.TableAdapter.Fill(this.DataSet.table1); // from a.mdb this.TableAdapter1.Fill(this.DataSet2.table1); // from b.mdb this.TableAdapter2.Fill(this.DataSet3.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**@discussions.microsoft.com> wrote in message news:7B**********************************@microsof t.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
Did you try Mel's code?
"Yuki" <Yu**@discussions.microsoft.com> wrote in message
news:33**********************************@microsof t.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.TableAdapter.Fill(this.DataSet.table1); // from
a.mdb
this.TableAdapter1.Fill(this.DataSet2.table1); // from
b.mdb
this.TableAdapter2.Fill(this.DataSet3.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**@discussions.microsoft.com> wrote in message news:7B**********************************@microsof t.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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
by: Luqman |
last post by:
Is it recommended to use datasets in ASP.Net 2.0 / VS.Net 2005 ?
Best Regards,
Luqman
|
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......
|
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...
|
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....
|
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...
|
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...
|
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
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |