473,789 Members | 2,746 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XML->Dataset->Database

I am developing a type of data warehouse. Basically, we have 20 client survey
machines that are each separated from the server by space and lack of
network. Yet both need to speak to each other such that the clients know the
latest configuration information and the server contains completed survey
data from the clients. Currently I'm accomplishing this by using a few
special database tables to control the flow of information, and using XML
serialized datasets on both ends and a USB drive to move them back and forth.
The design seems to work.

However, some of these tables have 50+ columns and creating manual insert
statements has gotten absurd. For example, on the server I generate a dataset
based on what needs to be sent to the client, it works fine. I then read in
that XML into a dataset on the client. So now, how do I best get that data
into the SQL database on the client side? The only way I've found to do it is
to create a DataAdapter and insert each row at a time, after setting up all
the commands, parameters, and filling out each row. This is absurd, it winds
up being hundreds of lines. I really want something like this:
Dataset ds;
ds.connection = my connection;
ds.update();

After all, the schema is exactly the same on both ends! So, I don't really
expect the above, but there has to be an easier way than reinventing the
wheel. Basically, I have a dataset full of data that matches the database I
want to get it inside, only it wasn't taken from that database so it's not
just a simple sqladapter.upda te() call.

Any ideas? Thanks in advance.
Jun 14 '06 #1
5 1434
Why can't you use bulk import and export feature of sqlserver. you can
import export xml documents also..

"David Harris" <Da*********@di scussions.micro soft.com> wrote in message
news:4B******** *************** ***********@mic rosoft.com...
I am developing a type of data warehouse. Basically, we have 20 client
survey
machines that are each separated from the server by space and lack of
network. Yet both need to speak to each other such that the clients know
the
latest configuration information and the server contains completed survey
data from the clients. Currently I'm accomplishing this by using a few
special database tables to control the flow of information, and using XML
serialized datasets on both ends and a USB drive to move them back and
forth.
The design seems to work.

However, some of these tables have 50+ columns and creating manual insert
statements has gotten absurd. For example, on the server I generate a
dataset
based on what needs to be sent to the client, it works fine. I then read
in
that XML into a dataset on the client. So now, how do I best get that data
into the SQL database on the client side? The only way I've found to do it
is
to create a DataAdapter and insert each row at a time, after setting up
all
the commands, parameters, and filling out each row. This is absurd, it
winds
up being hundreds of lines. I really want something like this:
Dataset ds;
ds.connection = my connection;
ds.update();

After all, the schema is exactly the same on both ends! So, I don't really
expect the above, but there has to be an easier way than reinventing the
wheel. Basically, I have a dataset full of data that matches the database
I
want to get it inside, only it wasn't taken from that database so it's not
just a simple sqladapter.upda te() call.

Any ideas? Thanks in advance.

Jun 14 '06 #2
Well, the main reason is that I want to edit the dataset before I import the
data. For example, the server sends down a lot of data, I import it into a
dataset, and depending on settings or actions the user makes I want to remove
or edit records in that dataset before I put it into the actual database.

Thanks
David

"Balasubramania n Ramanathan" wrote:
Why can't you use bulk import and export feature of sqlserver. you can
import export xml documents also..


Jun 14 '06 #3
Here is a good example
http://www.codeproject.com/cs/databa...ic_OpenXml.asp. Meets your
requirement
"David Harris" <Da*********@di scussions.micro soft.com> wrote in message
news:3F******** *************** ***********@mic rosoft.com...
Well, the main reason is that I want to edit the dataset before I import
the
data. For example, the server sends down a lot of data, I import it into a
dataset, and depending on settings or actions the user makes I want to
remove
or edit records in that dataset before I put it into the actual database.

Thanks
David

"Balasubramania n Ramanathan" wrote:
Why can't you use bulk import and export feature of sqlserver. you can
import export xml documents also..

Jun 14 '06 #4
That definitely looks like it would work. However, I have one idea, can you
look and see if this passes the logic test? I have limited time to test this
in field conditions, so I have to get it right and complete as possible
before I try actual testing...

Basically, I create two datasets, one for the XML I bring in from the
server, and one for the current client database. I then fill the client
dataset with the current information in the database, update it, and call the
Update method on it. DStransfer is the dataset schema.

DStransfer dsClient = new DStransfer();
DStransfer dsServer = new DStransfer();
// ... Code to read in from xml to dsServer
// ... Code to read in from Client DB to dsClient
foreach(DStrans fer.SurveyRow r in dsServer.Survey .Rows) {
dsClient.Survey .AddSurveyRow(r );
}
// repeat above for each table in the dataset...

Basically, I just move each row from one dataset to the other, and then call
update on the original DataAdapter that filled the client dataset... Does
this look like it will work? I know it'll be expensive performance-wise, but
that's not an issue this time around.

Thanks,
David
"Balasubramania n Ramanathan" wrote:
Here is a good example
http://www.codeproject.com/cs/databa...ic_OpenXml.asp. Meets your
requirement


Jun 14 '06 #5
Yeh...It should work without any problem. one more suggestion..ins tead of
adding rows one by one you can use Merge method of the datatable.

"David Harris" <Da*********@di scussions.micro soft.com> wrote in message
news:AD******** *************** ***********@mic rosoft.com...
That definitely looks like it would work. However, I have one idea, can
you
look and see if this passes the logic test? I have limited time to test
this
in field conditions, so I have to get it right and complete as possible
before I try actual testing...

Basically, I create two datasets, one for the XML I bring in from the
server, and one for the current client database. I then fill the client
dataset with the current information in the database, update it, and call
the
Update method on it. DStransfer is the dataset schema.

DStransfer dsClient = new DStransfer();
DStransfer dsServer = new DStransfer();
// ... Code to read in from xml to dsServer
// ... Code to read in from Client DB to dsClient
foreach(DStrans fer.SurveyRow r in dsServer.Survey .Rows) {
dsClient.Survey .AddSurveyRow(r );
}
// repeat above for each table in the dataset...

Basically, I just move each row from one dataset to the other, and then
call
update on the original DataAdapter that filled the client dataset... Does
this look like it will work? I know it'll be expensive performance-wise,
but
that's not an issue this time around.

Thanks,
David
"Balasubramania n Ramanathan" wrote:
Here is a good example
http://www.codeproject.com/cs/databa...ic_OpenXml.asp. Meets your
requirement


Jun 14 '06 #6

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

Similar topics

1
1577
by: Piyoosh Rai | last post by:
Hi, I have multiple XML files that I am reading into a DataSet in C#. What I would want to do it Create Tables from the DataSet in the destination database and fill the tables with data from the DataSet. Any ideas??? Thank you.
2
9833
by: Steven (dotnet newbie) | last post by:
Hello. I am trying to create a database from an XML file. I am able to create a dataset from the XML doc, but how can I create a database schema from the dataset and populate the database? Or is this even possible using VS.NET 2003? Part of the XML file follows. Thanks for any help. Steven VS.NET 2003 and C# newbie! ----- Part of the XML (one full record across several tables) --------
1
1273
by: Trey | last post by:
Let me ask one more time! If you have an application that uses a DataSet (System.Data) but the dataset is only loaded with XML data. Do you need to deploy MDAC with your application? Trey
0
1011
by: Chris Kennedy | last post by:
I am having big problem manipulating XML in a dataset. I am reading in a schema based on the following XML document. The minute I try to e.g. create a new row I get 'Object reference not set to an instance of an object' error <?xml version="1.0" encoding="utf-8"?> <DocumentElement xmlns="http://tempuri.org/dseditted2.xsd"> <TableInfo> <FieldName>column value</FieldName> <ControlType>column value</ControlType> <IsNull>column...
2
1392
by: JAS | last post by:
I have made client software where users make orders. Local data is stored in xml file. Users are offline from network most of time eg. one week or month and then they connect dbserver. Problem: How to synchronize offline database to sql server??? New, modified and deleted rows must be syncronize from client to server. All help, links, tips etc. is wellcome, thank you
1
1906
by: buran | last post by:
Dear ASP.NET Programmers, I need your help on the following case: 1. I have a page coverpage.aspx, on which I load invoice data into the datalist control dliHospCosts. I use the stored procedure spGetHospAmounts and load the data. <ItemTemplate> <TABLE id="Table77" width="100%"> <TR>
1
2904
by: Maziar Aflatoun | last post by:
Hi, I have a multi-level complex XML that I like to process and store in the database. I'm comfortable with using DataSet and then reading the tables (XML is parsed into 7 tables in my case) and processing the data. However, just to become familar with XmlTextReader, I've done the same thing using XmlTextReader. Any major difference between the two that I should be aware of for a production level application? Especially when the XML is...
5
2106
by: Benny Raymond | last post by:
I'm nearly done writing the first version of my tracking app and I'm starting to re-think the way I store my database. Currently I have my database setup as an xml dataset. Before I started the program I choose to go with a dataset because I was unclear if the end user would have to have access installed if I went with an access database. Recently I'm starting to realize (or think) that this isn't the case. And, from what I gather, the...
8
1382
by: Sam | last post by:
Hi there! I would like to know: a) How to read xml datasets from cache? b) How to save it as xml and map the fields and update the my sql / SYbase database? Please help me out.
2
1055
by: paulhux174 | last post by:
Hi, Is there a way of writing some xml data to a database table directly. I know you can extract the values then insert or update but can you some how create a xml dataset representation of the database table and just write the xml into it. Both the table and xml would have to have the same structure.
0
9666
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9511
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
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10139
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
9983
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
6769
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4092
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3700
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.