By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,034 Members | 1,247 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,034 IT Pros & Developers. It's quick & easy.

How save DataSet back to database?

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.