473,384 Members | 1,854 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,384 software developers and data experts.

Update unable to find TableMapping .. or Datatable

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.
Nov 19 '05 #1
1 5604
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" <xa*********@gmail.com> wrote in message
news:OP**************@tk2msftngp13.phx.gbl...
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.

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: JEP | last post by:
I lifted the following code directly from MSDN examples. However, the update command fails against my Northwind/SQL Server database. The code is: Private Sub cmdStart_Click(ByVal sender As...
1
by: jiangyh | last post by:
hey guys: I use SqlDataAdapt.update method to update database that appearance an error looks like following. Update unable to find TableMapping or DataTable 'Table'. Here is My Code...
1
by: cvncpu | last post by:
I have this function: public string SetUserInfo(string AuthID, DataSet dg2) { if (AuthID=="********") { Oconn.Open(); da.Update(dg2); Oconn.Close();
17
by: Benoit Martin | last post by:
I'm working on a project in VB.net connecting to a SQL Server 2000 database that I can't modify I created a dataset with a schema identical to the DB. When trying to update the DB from the dataset...
10
by: KevinMGore | last post by:
The following code: Try da.Update(ds.Tables(dg1Name)) Catch ex As Exception Console.WriteLine(ex.ToString) MessageBox.Show(ex.ToString) End Try causes this error:
2
by: explode | last post by:
I made nova oledbdataadapter select update insert and delete command and connection veza. dataset is Studenti1data, I made it by the new data source wizard,and made datagridview and bindingsource...
5
by: explode | last post by:
I made a procedure Public Sub Novo(ByVal nova1 As String, ByVal nova2 As String) that creates a new oledbDataAdapter with insert update select and delete commads. I also added that commands can...
0
by: brads745678 | last post by:
Hi, I am having a problem with my VB .NET application. I am trying to do the most simplest of things, and I've even achieved this task before. All I am trying to do is update an access DB from VB...
0
jas16183
by: jas16183 | last post by:
Hi Guys, need some help here, Im working on a project in vb.net, the problem im facing is that my tableadapter.update(dataset.datatable) is not functioning, the datatable has a relation with...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.