Update unable to find TableMapping .. or Datatable

X

xaime

Hi all,

I have the code below. This is doing what I want, but always has the
following exception:

Update unable to find TableMapping ['mytable'] or Datatable 'mytable'

The code I'm using is:
Try

Dim aDispuesto As Single, aDisponible As Single

aDispuesto = Session("dispuesto") + APagar

aDisponible = Session("disponible") - APagar

' conexión con tbEmprendedor

Dim oDSemp As Data.DataSet = New DataSet("DatasetEmprendedor")

' consulta de actualización con nuevos valores

Dim SQLemp As String

SQLemp = "UPDATE tbEmprendedor" & _

" SET Dispuesto = " & aDispuesto & ", Disponible = " & aDisponible & _

" WHERE id_Emprendedor = " _

& CType(idEmp, Integer) & ";"

Dim oDAemp As New OleDb.OleDbDataAdapter(SQLemp, oCnn1)

oDAemp.Fill(oDSemp)

oDAemp.UpdateCommand = New OleDb.OleDbCommand

oDAemp.UpdateCommand.CommandText = SQLemp

oDAemp.UpdateCommand.Connection = oCnn1

' Actualizar

oDAemp.Update(oDSemp, "tbEmprendedor")

oCnn1.Close()

Catch ex As Exception

lblMensaje.Text = lblMensaje.Text & "<br>Excepcion tbEmprendedor: {0}" &
ex.Message

End Try



Thanks for helping me.
 
D

David Lloyd

Xaime:

One thing I notice, and this depends on parts of the code that are not
shown, is that when you fill your dataset, you are not using one of the
overloads of the Fill method to give the table a name. I believe the
default name is just "Table." Therefore when you use the Update method,
your reference to "tbEmprendedor" would not be recognized.

This assumes of course that there is only one table in your dataset, which
again depends on the full code you are using.

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.
 

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

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top