Groups | Blog | Home
all groups > asp.net > january 2004 >

asp.net : Why the source database not updated?



CM
1/3/2004 10:17:19 PM
Hi there:
Following is the code, after change the Dataset, accepte the change =
made to the dataset and excute the update of Adapter, nothing happened =
to the database source database, what's wrong?
Thanks!
CM

-------------------------------------------------
Private Sub UpdateApartment()
Dim i As Integer
Dim myDataAdapter As OleDbDataAdapter
Dim myDataset As DataSet
Dim MyConnection As OleDbConnection

i =3D Session("intIndex")
myDataset =3D Session("tableApt")
myDataAdapter =3D Session("myAdapter")
MyConnection =3D Session("ADMConn")
With myDataset.Tables("Apt")
.Rows(i)("Company") =3D txtCompanyName.Text
.Rows(i)("BuildingName") =3D txtBuildingName.Text
End With

myDataset.AcceptChanges()
MyConnection.Open()
myDataAdapter.Update(myDataset)
MyConnection.Close()

CM
1/4/2004 12:01:57 PM
Sorry, the above code result this error:

System.InvalidOperationException: Update unable to find =
TableMapping['Table'] or DataTable 'Table'.

I changed the update code to:
myDataAdapter.Update(myDataset, "Apt")

The error is gone, but the source database still not updated.

CM





[quoted text, click to view]
Hi there:
Following is the code, after change the Dataset, accepte the change =
made to the dataset and excute the update of Adapter, nothing happened =
to the database source database, what's wrong?
Thanks!
CM

-------------------------------------------------
Private Sub UpdateApartment()=20
Dim i As Integer=20
Dim myDataAdapter As OleDbDataAdapter=20
Dim myDataset As DataSet=20
Dim MyConnection As OleDbConnection=20
=20
i =3D Session("intIndex")=20
myDataset =3D Session("tableApt")=20
myDataAdapter =3D Session("myAdapter")=20
MyConnection =3D Session("ADMConn")=20
With myDataset.Tables("Apt")=20
.Rows(i)("Company") =3D txtCompanyName.Text=20
.Rows(i)("BuildingName") =3D txtBuildingName.Text=20
End With=20
=20
myDataset.AcceptChanges()=20
MyConnection.Open()=20
myDataAdapter.Update(myDataset)=20
MyConnection.Close()=20
=20
AddThis Social Bookmark Button