I am using VB ASP.NET. In my page I convert an uploaded XML file to a
dataset as follows:
Dim ds1 As DataSet = New DataSet
ds1.ReadXml(str PathName, XmlReadMode.Aut o)
Now I want to append all the rows of ds1 to an existing table in an SQL
Server database. I know I can do things like looping through the dataset and
issuing Update SQL statements to do this but I suspect there is a better
way? I tried Google but am not getting any usable hits. Does anyone have a
suggestion on a better way to accomplish adding the contents of a dataset to
an existing table?
Wayne 5 2956
Hi Wayne,
You can use the DataAdapter class to get your changes from the DataSet into
the SQL Server database. Microsoft has published a HowTo article with some
sample source code on how to do this: http://support.microsoft.com/kb/308055/EN-US/
Cheers,
Gwynn
-----------------------------------------------------------------
Gwynn Kruger http://www.compusolvecanada.com
-----------------------------------------------------------------
"Wayne Wengert" wrote: I am using VB ASP.NET. In my page I convert an uploaded XML file to a dataset as follows:
Dim ds1 As DataSet = New DataSet
ds1.ReadXml(str PathName, XmlReadMode.Aut o)
Now I want to append all the rows of ds1 to an existing table in an SQL Server database. I know I can do things like looping through the dataset and issuing Update SQL statements to do this but I suspect there is a better way? I tried Google but am not getting any usable hits. Does anyone have a suggestion on a better way to accomplish adding the contents of a dataset to an existing table? Wayne
Thanks for that pointer Gwynn. I'll check that out.
Wayne
"Gwynn Kruger" <Gw*********@di scussions.micro soft.com> wrote in message
news:AF******** *************** ***********@mic rosoft.com... Hi Wayne,
You can use the DataAdapter class to get your changes from the DataSet
into the SQL Server database. Microsoft has published a HowTo article with some sample source code on how to do this: http://support.microsoft.com/kb/308055/EN-US/
Cheers, Gwynn
----------------------------------------------------------------- Gwynn Kruger http://www.compusolvecanada.com -----------------------------------------------------------------
"Wayne Wengert" wrote:
I am using VB ASP.NET. In my page I convert an uploaded XML file to a dataset as follows:
Dim ds1 As DataSet = New DataSet
ds1.ReadXml(str PathName, XmlReadMode.Aut o)
Now I want to append all the rows of ds1 to an existing table in an SQL Server database. I know I can do things like looping through the dataset
and issuing Update SQL statements to do this but I suspect there is a better way? I tried Google but am not getting any usable hits. Does anyone have
a suggestion on a better way to accomplish adding the contents of a
dataset to an existing table? Wayne
Gwynn;
That article seems to simply show how the Update, Insert and Delete commands
can be built when using a Select for a single table. The Update/Insert apply
to the original table. In my case, I am getting the dataset from an XML file
and writing the output to an SQL table. For right now I simply coded the
Insert command manually but it seems like there ought to be a more efficient
way?
Wayne
"Wayne Wengert" <wa************ ***@wengert.com > wrote in message
news:On******** ******@TK2MSFTN GP09.phx.gbl... Thanks for that pointer Gwynn. I'll check that out.
Wayne
"Gwynn Kruger" <Gw*********@di scussions.micro soft.com> wrote in message news:AF******** *************** ***********@mic rosoft.com... Hi Wayne,
You can use the DataAdapter class to get your changes from the DataSet into the SQL Server database. Microsoft has published a HowTo article with
some sample source code on how to do this: http://support.microsoft.com/kb/308055/EN-US/
Cheers, Gwynn
----------------------------------------------------------------- Gwynn Kruger http://www.compusolvecanada.com -----------------------------------------------------------------
"Wayne Wengert" wrote:
I am using VB ASP.NET. In my page I convert an uploaded XML file to a dataset as follows:
Dim ds1 As DataSet = New DataSet
ds1.ReadXml(str PathName, XmlReadMode.Aut o)
Now I want to append all the rows of ds1 to an existing table in an
SQL Server database. I know I can do things like looping through the
dataset and issuing Update SQL statements to do this but I suspect there is a
better way? I tried Google but am not getting any usable hits. Does anyone
have a suggestion on a better way to accomplish adding the contents of a dataset to an existing table? Wayne
Wayne,
What do you mean by more efficient? More efficient as in less source code or
more efficient as in executing faster during runtime?
The article shows how you specify a Select statement for the DataAdapter so
that the CommandBuilder can dynamically determine the SQL needed to execute
the Update, Insert, and Delete commands. This helps out if you're not all
that familiar with SQL.
It sounds like you've coded up the Insert statement yourself in which case
you wouldn't need the CommandBuilder code but would still need to use the
DataAdapter to update the SQL Database.
Could you please post your source code so I can check it out?
Cheers,
Gwynn
-----------------------------------------------------------------
Gwynn Kruger http://www.compusolvecanada.com
-----------------------------------------------------------------
"Wayne Wengert" wrote: Gwynn;
That article seems to simply show how the Update, Insert and Delete commands can be built when using a Select for a single table. The Update/Insert apply to the original table. In my case, I am getting the dataset from an XML file and writing the output to an SQL table. For right now I simply coded the Insert command manually but it seems like there ought to be a more efficient way?
Wayne
"Wayne Wengert" <wa************ ***@wengert.com > wrote in message news:On******** ******@TK2MSFTN GP09.phx.gbl... Thanks for that pointer Gwynn. I'll check that out.
Wayne
"Gwynn Kruger" <Gw*********@di scussions.micro soft.com> wrote in message news:AF******** *************** ***********@mic rosoft.com... Hi Wayne,
You can use the DataAdapter class to get your changes from the DataSet into the SQL Server database. Microsoft has published a HowTo article with some sample source code on how to do this: http://support.microsoft.com/kb/308055/EN-US/
Cheers, Gwynn
----------------------------------------------------------------- Gwynn Kruger http://www.compusolvecanada.com -----------------------------------------------------------------
"Wayne Wengert" wrote:
> I am using VB ASP.NET. In my page I convert an uploaded XML file to a > dataset as follows: > > Dim ds1 As DataSet = New DataSet > > ds1.ReadXml(str PathName, XmlReadMode.Aut o) > > Now I want to append all the rows of ds1 to an existing table in an SQL > Server database. I know I can do things like looping through the dataset and > issuing Update SQL statements to do this but I suspect there is a better > way? I tried Google but am not getting any usable hits. Does anyone have a > suggestion on a better way to accomplish adding the contents of a dataset to > an existing table? > > > > Wayne > > >
I create the dataset from an XML file. I do not issue any Select statement.
That is part of the difference!
Wayne
"Gwynn Kruger" <Gw*********@di scussions.micro soft.com> wrote in message
news:CB******** *************** ***********@mic rosoft.com... Wayne,
What do you mean by more efficient? More efficient as in less source code
or more efficient as in executing faster during runtime?
The article shows how you specify a Select statement for the DataAdapter
so that the CommandBuilder can dynamically determine the SQL needed to
execute the Update, Insert, and Delete commands. This helps out if you're not all that familiar with SQL.
It sounds like you've coded up the Insert statement yourself in which case you wouldn't need the CommandBuilder code but would still need to use the DataAdapter to update the SQL Database.
Could you please post your source code so I can check it out?
Cheers, Gwynn
----------------------------------------------------------------- Gwynn Kruger http://www.compusolvecanada.com -----------------------------------------------------------------
"Wayne Wengert" wrote:
Gwynn;
That article seems to simply show how the Update, Insert and Delete
commands can be built when using a Select for a single table. The Update/Insert
apply to the original table. In my case, I am getting the dataset from an XML
file and writing the output to an SQL table. For right now I simply coded the Insert command manually but it seems like there ought to be a more
efficient way?
Wayne
"Wayne Wengert" <wa************ ***@wengert.com > wrote in message news:On******** ******@TK2MSFTN GP09.phx.gbl... Thanks for that pointer Gwynn. I'll check that out.
Wayne
"Gwynn Kruger" <Gw*********@di scussions.micro soft.com> wrote in
message news:AF******** *************** ***********@mic rosoft.com... > Hi Wayne, > > You can use the DataAdapter class to get your changes from the
DataSet into > the SQL Server database. Microsoft has published a HowTo article
with some > sample source code on how to do this: > http://support.microsoft.com/kb/308055/EN-US/ > > Cheers, > Gwynn > > ----------------------------------------------------------------- > Gwynn Kruger > http://www.compusolvecanada.com > ----------------------------------------------------------------- > > > "Wayne Wengert" wrote: > > > I am using VB ASP.NET. In my page I convert an uploaded XML file
to a > > dataset as follows: > > > > Dim ds1 As DataSet = New DataSet > > > > ds1.ReadXml(str PathName, XmlReadMode.Aut o) > > > > Now I want to append all the rows of ds1 to an existing table in
an SQL > > Server database. I know I can do things like looping through the dataset and > > issuing Update SQL statements to do this but I suspect there is a better > > way? I tried Google but am not getting any usable hits. Does
anyone have a > > suggestion on a better way to accomplish adding the contents of a dataset to > > an existing table? > > > > > > > > Wayne > > > > > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: JMCN |
last post by:
hi
i have a general question regarding append queries in access 97. each
week i need to update my table(tblonlinereg) with new or modified
records. firstly, i import the text file into my database and then i
create a basic append query that appends the new records to the
table(tblonlinereg). this works great if the field is
greater than the last record appended ( where: tempID > 198 ) but how
would i update/append the modifications...
|
by: Sven Pran |
last post by:
Probably the answer is there just in front of me only awaiting me to
discover it,
but:
1: I want to build a query that returns all records in one table for which
there is no successful "join" in another table but I have not found what the
field
criteria should look like?
2: And if/when I succeed I should further like to build a new record (with
|
by: Peter |
last post by:
I have an Access database and it has several tables, I would like to export some of the data from those tables into one XML file.
Is there a way to append data to XML file or merge all the data from all the tables into one XML file
I am using the following code, but it overwrites data for every dataset.
DataSet ds = new DataSet();
....
....
....
ds.WriteXml(@"C:\outputfile.xml", System.Data.XmlWriteMode.WriteSchema);
|
by: Steven C |
last post by:
Hello:
I am trying to append a dataset that draws its data from a MSDE
instance, and I keep getting the exception:
Can't create a child list for field tblCustomers.
conn = new SqlConnection("Data Source=SWC_K7\\CHRISMON1;User
|
by: M. David Johnson |
last post by:
I cannot get my OleDbDataAdapter to update my database
table from my local dataset table. The Knowledge Base
doesn't seem to help - see item 10 below.
I have a Microsoft Access 2000 database which indexes
computer magazine articles for personal reference.
I am developing a Visual Basic.NET program whose sole
purpose is to enter new records into the database. No
updates to existing entries, no deletions, and no display
| |
by: P K |
last post by:
Hello,
I have a dataset which is already loaded with data in one table.
so dataset.tables("data") exists and has data.
Now, I have to add another table to the dataset. The source for this table
is a XMLDoc. So I have the XML in a XMLDoc and I need to create a table in
the dataset which would read xml from the XMLDoc .
So in essence I need something like
|
by: Al |
last post by:
I have this scenario:
1. XML file with schema and data is created from SQL Server tables. XML file
contains 6 tables, some of them have rows, some of them are empty.
2. XML file is given to the person with Pocket PC.
3. XML file is used to populate DataSet on the Pocket PC.
4. User adds new rows, changes values, deletes some rows.
5. Altered dataset is saved back to XML file.
6. XML file is given back to the person who initially created...
|
by: MN |
last post by:
I have to import a tab-delimited text file daily into Access through a
macro. All of the data needs to be added to an existing table. Some of
the data already exists but may be updated by the imported text file. I
can update the data through an update query or append the entire import
table through an append query. Is there a way to combine the two so that
I can update existing records and append only new records (without
duplicating...
|
by: SePp |
last post by:
Hi,
I have one dataset which is exported to an external file (excel)
My problem is that I want to append the data of two different views to
one dataset. (because they have to be displayed in an sheet among each
other)
Something like:
cmd = new OracleDataAdapter("Select * from view1");
cmd.Tablemappings.Add("Table", "Views");
|
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...
|
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,...
| |
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...
|
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,...
|
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...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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
| |