Re: Join DataTables in same dataset
- From: "don" <don.mcleod@xxxxxxx>
- Date: Wed, 15 Nov 2006 22:26:21 GMT
Thanks for the reply, I won't need to "unmerge" the data later. The Excel
sheet has all the contacts that currently reside in the DB plus new ones.
All I want to do is take the new customers and append to the database in
access.
Seems simple I want to take data from a DataTable and put it into an
existing access table. Even if i do merge the data in the c# project i
still have to get the dataset to update back to the database.
"ssamuel" <ssamuel@xxxxxxxxx> wrote in message
news:1163536573.312271.141340@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Don,
As far as the framework is concerned, any two given DataTable objects
have different schemas. Even if they look the same to you, they're not
to the framework.
Your best bet here is probably to Merge() one DataTable into the other.
The Merge() process will deal with the issues like, "what if the
schemas are different," or, "what if the columns are in a different
order," and give you fine-grained control of how to deal with that. If
your assumption that the schemas are identical is correct, you'll get
no exceptions.
Once the data is merged, you'll have to separate what goes where. It
may be useful to add a source column (pre-merge) to each table that
contains a static value based on where it came from. Then it's much
easier to un-munge later.
Stephan
don wrote:
I have written a program to hold a sales contact db. It is written in c#
express.
an update is sent from head office in xl format, i need to import only
the
new rows to an access database.
I have gotten this far:
a separate OleDbconnection to each source, which reads the entire data
source (select *) into the same dataset, but different tables.
from here i want to be able to pull the new rows from the xl table and
append it to the access table.
When I try to create a relation between the two table it says "This
constraint cannot be enabled as not all values have corresponding parent
values."
*******************************************************************************************************************
DataColumn parentColumn =
accessdata.Tables["gnwestcustomers"].Columns["Customer Number"];
DataColumn childColumn = accessdata.Tables["Table"].Columns["Customer
Number"];
DataRelation relExcel;
relExcel = new DataRelation("RelateExcel", parentColumn, childColumn);
accessdata.Relations.Add(relExcel);
***************************************************************************************************************************************
I can do this all in MSAccess easily, but the user needs to be able to do
it
in the field....come on people sales person here.......not technically
enabled in the computer department if you know what i mean... :)
any help appreciated.
Thanks in advance.
.
- Follow-Ups:
- Re: Join DataTables in same dataset
- From: don
- Re: Join DataTables in same dataset
- References:
- Join DataTables in same dataset
- From: don
- Re: Join DataTables in same dataset
- From: ssamuel
- Join DataTables in same dataset
- Prev by Date: Re: Obtaining control under mouse
- Next by Date: Re: C# and 'memory buffers'
- Previous by thread: Re: Join DataTables in same dataset
- Next by thread: Re: Join DataTables in same dataset
- Index(es):
Relevant Pages
|