473,405 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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.ConnectionString = My.Settings.COWFeedyardConnectionString
Dim Command As New SqlCommand()
Command.Connection = Connection
Dim DataAdapter As New SqlDataAdapter()
DataAdapter.UpdateCommand = Command
DataAdapter.Update(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 9585
And actually, I just changed the update line to instead read:

DataAdapter.Update(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**************@TK2MSFTNGP05.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.ConnectionString = My.Settings.COWFeedyardConnectionString
Dim Command As New SqlCommand()
Command.Connection = Connection
Dim DataAdapter As New SqlDataAdapter()
DataAdapter.UpdateCommand = Command
DataAdapter.Update(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.update, it
knows what to do.
"Ronald S. Cook" <rc***@westinis.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
And actually, I just changed the update line to instead read:

DataAdapter.Update(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**************@TK2MSFTNGP05.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.ConnectionString = My.Settings.COWFeedyardConnectionString
Dim Command As New SqlCommand()
Command.Connection = Connection
Dim DataAdapter As New SqlDataAdapter()
DataAdapter.UpdateCommand = Command
DataAdapter.Update(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
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...
2
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...
1
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...
0
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...
6
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...
1
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...
1
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...
3
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...
1
by: kiranbabu | last post by:
<html> <head> <style type="text/css"> h2{color:#A02820} </style> </head> <script language=javascript>
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
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...
0
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...
0
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,...
0
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...

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.