Updating problem

G

G. Dean Blake

I have created a table by running a script from my code. I have also
created a matching dataset
loaded with data for this new table. I now have to get the data in the
dataset into the table.

I figured I would create a SqlDataAdapter and a SqlCommandBuilder and then
use ado.net to do my

update as follows....
sql = "SELECT SubID, Code, State, Market, CrewCount, DayRate, NightRate,
HolidayRate " & _
"FROM(SubServices)"
Dim da As New SqlDataAdapter(sql, cn)
Dim cb As New SqlCommandBuilder(da)
da.Update(newSSDS)

but this gets the following exception...


system.invalidOperationException

Unable to find tableMapping['Table'] or datatable 'Table'

Why am I getting this? Is there an easier way to do this?
TIA
G.
 
G

Guest

Where in your code do you actually populate dataset with data? You need to use .Fill method of dataAdapter to do that.

something like this:
da.Fill(Mydataset, "TableName")
 
G

G. Dean Blake

I did that of course. I didn't want to post my entire program. I built the
dataset in other code.
G

Lenn said:
Where in your code do you actually populate dataset with data? You need to
use .Fill method of dataAdapter to do that.
something like this:
da.Fill(Mydataset, "TableName")


G. Dean Blake said:
I have created a table by running a script from my code. I have also
created a matching dataset
loaded with data for this new table. I now have to get the data in the
dataset into the table.

I figured I would create a SqlDataAdapter and a SqlCommandBuilder and then
use ado.net to do my

update as follows....
sql = "SELECT SubID, Code, State, Market, CrewCount, DayRate, NightRate,
HolidayRate " & _
"FROM(SubServices)"
Dim da As New SqlDataAdapter(sql, cn)
Dim cb As New SqlCommandBuilder(da)
da.Update(newSSDS)

but this gets the following exception...


system.invalidOperationException

Unable to find tableMapping['Table'] or datatable 'Table'

Why am I getting this? Is there an easier way to do this?
TIA
G.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,602
Members
45,182
Latest member
BettinaPol

Latest Threads

Top