Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Update unable to find TableMapping .. or Datatable

Reply
Thread Tools

Update unable to find TableMapping .. or Datatable

 
 
xaime
Guest
Posts: n/a
 
      05-05-2005
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.


 
Reply With Quote
 
 
 
 
David Lloyd
Guest
Posts: n/a
 
      05-05-2005
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.


"xaime" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Update unable to find TableMapping['Table'] or DataTable 'Table' in c# sqlserver Nishanth Software 0 11-09-2009 09:58 AM
Sort a datatable and create a new datatable Fredrik Rodin ASP .Net 3 09-28-2007 07:28 AM
Use of TableMapping ? =?Utf-8?B?c2VyZ2UgY2FsZGVyYXJh?= ASP .Net 1 11-15-2005 03:11 PM
Casting DataTable to class inherit from DataTable =?Utf-8?B?Qmx1ZWZsb3dlcg==?= ASP .Net 0 04-02-2004 05:41 AM
Adding DataTable Rows To another DataTable J. Babe ASP .Net 1 08-15-2003 05:04 PM



Advertisments