473,804 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How save DataSet back to database?

In my client Windows application, I am receiving a DataSet containing one
DataTable. This comes to my client via the business tier on a different
physical machine (we're using WCF if that matters).

After I make changes to the data in the underlying DataTable, I send the
DataSet back to the business tier. In the business tier, what should my
code look like to persist the data up to the database?

I'm assuming I need to do something like this:

Dim Connection As New SqlConnection()
Connection.Conn ectionString = My.Settings.COW FeedyardConnect ionString
Dim Command As New SqlCommand()
Command.Connect ion = Connection
Dim DataAdapter As New SqlDataAdapter( )
DataAdapter.Upd ateCommand = Command
DataAdapter.Upd ate(PenDataSet)

... but I get the errror: "Update unable to find TableMapping['Table'] or
DataTable 'Table'."

Thanks for any help,
Ron
Jul 14 '07 #1
2 9622
And actually, I just changed the update line to instead read:

DataAdapter.Upd ate(PenDataSet, "Results")
The code now does not break on error, it seems to execute the line but no
changes were actually ssaved to the database.

Thanks,
Ron
"Ronald S. Cook" <rc***@westinis .comwrote in message
news:ed******** ******@TK2MSFTN GP05.phx.gbl...
In my client Windows application, I am receiving a DataSet containing one
DataTable. This comes to my client via the business tier on a different
physical machine (we're using WCF if that matters).

After I make changes to the data in the underlying DataTable, I send the
DataSet back to the business tier. In the business tier, what should my
code look like to persist the data up to the database?

I'm assuming I need to do something like this:

Dim Connection As New SqlConnection()
Connection.Conn ectionString = My.Settings.COW FeedyardConnect ionString
Dim Command As New SqlCommand()
Command.Connect ion = Connection
Dim DataAdapter As New SqlDataAdapter( )
DataAdapter.Upd ateCommand = Command
DataAdapter.Upd ate(PenDataSet)

.. but I get the errror: "Update unable to find TableMapping['Table'] or
DataTable 'Table'."

Thanks for any help,
Ron


Jul 14 '07 #2
You have created an instance of a command object, but you haven't configured
the command object's .commandText property to anything. It needs to be set
to a valid update statement, so that when you call dataadapter.upd ate, it
knows what to do.
"Ronald S. Cook" <rc***@westinis .comwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
And actually, I just changed the update line to instead read:

DataAdapter.Upd ate(PenDataSet, "Results")
The code now does not break on error, it seems to execute the line but no
changes were actually ssaved to the database.

Thanks,
Ron
"Ronald S. Cook" <rc***@westinis .comwrote in message
news:ed******** ******@TK2MSFTN GP05.phx.gbl...
>In my client Windows application, I am receiving a DataSet containing one
DataTable. This comes to my client via the business tier on a different
physical machine (we're using WCF if that matters).

After I make changes to the data in the underlying DataTable, I send the
DataSet back to the business tier. In the business tier, what should my
code look like to persist the data up to the database?

I'm assuming I need to do something like this:

Dim Connection As New SqlConnection()
Connection.Con nectionString = My.Settings.COW FeedyardConnect ionString
Dim Command As New SqlCommand()
Command.Connec tion = Connection
Dim DataAdapter As New SqlDataAdapter( )
DataAdapter.Up dateCommand = Command
DataAdapter.Up date(PenDataSet )

.. but I get the errror: "Update unable to find TableMapping['Table'] or
DataTable 'Table'."

Thanks for any help,
Ron



Jul 15 '07 #3

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

Similar topics

1
1728
by: Mike Hnatt | last post by:
I'm baffled. My data store (database) is not updating with a refreshed dataset. Here's what is going on: 1) Create a dataset from a table in a database. 2) Create a copy of this dataset and maniuplate (update some records) 3) Now, merge this copied dataset back into the original dataset (using the Merge method) 4) Now display this original dataset in a datagrid to prove the data has
2
2005
by: Lawrence Chang | last post by:
Hi My friends, Can I save dataset object to an application variable? I want all the customer use this dataset. and diffrent customer create diffrent dataview object from this dataset, so it don't need to connect to database everytime .. I know I can use cache object , but cache object can be deleted automatically if server's memory is low, is this correct? Would you like to give me more information about how to improve database webform...
1
1592
by: simon | last post by:
I have time in my program: for example: dim timeTest as datetime timeTest="10:15:10" I save this time to database as decimal value: timeTest.ToOADate - I get the decimal value and I save it to database
0
1001
by: Feng | last post by:
Sorry about the last post. Made a mistake by clicking on the Post before finishing... I have a task that seems easy but I still don't have a symple way to do it: I need to read in an exasting XML file, find a certain node using XPath, change the value of the node, then save it back to the file. So, as you see, only the value of one entry needs to be changed. Everything else will be kept the same.
6
1166
by: simonakiki | last post by:
hello i am a new programmer and i need to save a dataset in C# for future use or for better backup it's mean when i have a data set of tabels i need to save it anywhere ,if i lost my data i can reuse this data set . 10x for helping me
1
1339
by: stevenpkent | last post by:
I need to allow user to save dataset to their computer in Microsoft Money format. I searched internet for help on this but found nothing helpful. I also chatted with MS Online Concierge to no avail. And posted to MS Managed Newsgroup. If you could, please provide pointers to steps how to accomplish this. If you will provide the steps yourself, please be very explicit in what
1
985
by: Creini | last post by:
Hi, I'm trying to write a Webapplication in ASP.Net 3.5 and C#. I read data from a database and Bind it to a FormView using <%# Eval("Columname") %> Which works quite well. But I have no idea how to save the changes back to the database. Well, I think I can use the dataadapter.update function, but I don't know how to call it before my page does a postback and loose all my changes.
3
2076
by: sachinkale123 | last post by:
I am using SQL Adapter to select data from a table in SQL Server Database. After creating Object I am filling that to a datatable. Assum that dataset has 5 row. After that I m updating that dataset and add 3 more rows. but not able to update that dataset to database table. My code is following. SqlDataAdapter SDA = new SqlDataAdapter("Select * from WFF", DAC.Conn); SDA.Fill(dt,"WFF"); //Updates dt here SDA.Update(dt); It does...
1
2285
by: kiranbabu | last post by:
<html> <head> <style type="text/css"> h2{color:#A02820} </style> </head> <script language=javascript>
0
9712
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
10595
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
10341
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
9171
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
7634
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
6862
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
5530
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...
1
4308
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
3831
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.