I have a database Access and its sitting on a webserver and has datasets exposed via a webservice that my windows application is using.

I one form I have a datagrid that is bound to the dataset exposed by the webservice. I have set one of my columns from to be a computed column:


Dim datable as DataTable
datable = objDataSet1.Orders
datable.Columns("RuningTotal").DataType = System.Type.GetType("System.Decimal")
datable.Columns("RuningTotal").Expression = "Prix - Acompte"

Here is my LoadDataset function:

Public Sub LoadDataSet1(ByVal Id As System.String)
Dim objService As Etudiant2003.com.tzo.ifalpes.Service1
objService = New Etudiant2003.com.tzo.ifalpes.Service1()
'Create a new dataset to hold the records returned from the call to FillDataSet.
'A temporary dataset is used because filling the existing dataset would
'require the databindings to be rebound.
Dim objDataSet1Temp As Etudiant2003.com.tzo.ifalpes.DataSet1
objDataSet1Temp = New Etudiant2003.com.tzo.ifalpes.DataSet1()
Try
'Attempt to fill the temporary dataset.
objDataSet1Temp = objService.GetData(Id)
CrReport.SetDataSource(objDataSet1Temp)
Catch eFillDataSet As System.Exception
'Add your error handling code here.
Throw eFillDataSet
End Try
Try
'Empty the old records from the dataset.
objDataSet1.Clear()
'Merge the records into the main dataset.
objDataSet1.Merge(objDataSet1Temp)
Catch eLoadMerge As System.Exception
'Add your error handling code here.
Throw eLoadMerge
End Try
datable = objDataSet1.Orders
datable.Columns("RuningTotal").DataType = System.Type.GetType("System.Decimal")
datable.Columns("RuningTotal").Expression = "Prix - Acompte"
End Sub

And here is my Update Function:

Public Sub UpdateDataSet1()
Dim objService As Etudiant2003.com.tzo.ifalpes.Service1
objService = New Etudiant2003.com.tzo.ifalpes.Service1()
'Create a new dataset to hold the changes that have been made to the main dataset.
Dim objDataSet1Changes As Etudiant2003.com.tzo.ifalpes.DataSet1 = New Etudiant2003.com.tzo.ifalpes.DataSet1()
Dim objDataSet1Updated As System.Data.DataSet = New Etudiant2003.com.tzo.ifalpes.DataSet1()
'Stop any current edits.
Me.BindingContext(objDataSet1, "Students").EndCurrentEdit()
Me.BindingContext(objDataSet1, "TheCourses").EndCurrentEdit()
'Get the changes that have been made to the main dataset.
objDataSet1.Merge(datable.GetChanges)
objDataSet1Changes = CType(objDataSet1.GetChanges, Etudiant2003.com.tzo.ifalpes.DataSet1)
'Check to see if any changes have been made.
If (Not (objDataSet1Changes) Is Nothing) Then
Try
'There are changes that need to be made, so attempt to update the datasource by
'calling the update method and passing the dataset and any parameters.
objDataSet1Updated = objService.UpdateDataset(objDataSet1Changes)
Catch eUpdate As System.Exception
'Add your error handling code here.
Throw eUpdate
End Try
'Add your code to check the returned dataset for any errors that may have been
'pushed into the row object's error.
Try
objDataSet1.Merge(objDataSet1Updated)
Catch eUpdateMerge As System.Exception
'Add exception handling code here
Throw eUpdateMerge
End Try
'Commit the changes that were just merged
'This moves any rows marked as updated, inserted or changed to being marked as original values
objDataSet1.AcceptChanges()
End If

End Sub

And I keep getting an error saying it failed because of the usage of a computed column.

How to implement a computed colum and persist the data ?

Can someone help me with this?