G
Guest
Hello I'm getting the above mentioned error in my applicatio
I have a datagrid bound to a datasource like s
MyDatagrid.DataSource = Mydataset.Tables(Order) - this all works fine
However I have another field on the form which is a richtextbox and is bound to another field in the same datasourc
like s
Me.RtxtDialog.DataBindings.Add("text", MyDataset.Tables.Item("Orders"), "MyRichTextField") - this field accepts nulls in the databas
If you just want to add values to the grid and amend the grid it works fine however when you add new records to th
grid and associated values in the rtxDialog text field we get the error
Currency Violation. Update command affect 0 records - when you click on the next row
My Datagrid Currentcellchanged event is as follow
Private Sub MyDataGrid_CurrentCellChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyDataGrid.CurrentCellChange
Dim IntRowNum As Integer = MyDataGrid.CurrentCell.RowNumbe
Dim MyGridfunctions As New ProjectNameSpace.Gridfunction
Dim IntNumRows As Integer = MyGridfunctions.NumRowsInGrid(MyDataGrid
Dim MyDataAccess As New DataAccess.DataAcces
If IntRowNum <= IntNumRows The
Call Updatedialogue(StrTypeOfdialogue
ElseIf IntRowNum = IntNumRows Then 'adding a new row
Call Updatedialogue(StrTypeOfdialogue
End I
End Su
Private Sub Updatedialogue(ByVal strtable As String
Dim MyDataAccess As New DataAccess.DataAcces
DirectCast(BindingContext(mydataset.Tables.Item(Orders)), CurrencyManager).EndCurrentEdit(
If MyDataSet.HasChanges The
Call MyDataAccess.UpdateDataSet(MyDataset, MysqldataAdapter, Orders
End I
End Su
'THIS IS WHERE THE ERROR OCCUR
Public Sub UpdateDataSet(ByRef MyDataset As DataSet, ByVal Mysqldataadapter As SqlDataAdapter, ByVal strTable As String
Dim objCommandBuilder As New SqlCommandBuilder(Mysqldataadapter
Tr
Mysqldataadapter.Update(MyDataset, strTable
Catch e As Exceptio
MsgBox(e.Message
End Tr
End Su
Any ideas how to avoid this error, what I'm doing wrong or at least how I can see the actual update command that is been performed, including the values of the parameters. I've tried myadapter.updatecommand.parameters.item(0). etc and is says that the parameters have a value of nothing on both the successfull and non successfull updates
The error only occurs when adding a new row and then adding something in the non-datagrid field rtxtDialog and then clicking on the next row in the grid
Any help would be greatly appreciate
Ger
I have a datagrid bound to a datasource like s
MyDatagrid.DataSource = Mydataset.Tables(Order) - this all works fine
However I have another field on the form which is a richtextbox and is bound to another field in the same datasourc
like s
Me.RtxtDialog.DataBindings.Add("text", MyDataset.Tables.Item("Orders"), "MyRichTextField") - this field accepts nulls in the databas
If you just want to add values to the grid and amend the grid it works fine however when you add new records to th
grid and associated values in the rtxDialog text field we get the error
Currency Violation. Update command affect 0 records - when you click on the next row
My Datagrid Currentcellchanged event is as follow
Private Sub MyDataGrid_CurrentCellChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyDataGrid.CurrentCellChange
Dim IntRowNum As Integer = MyDataGrid.CurrentCell.RowNumbe
Dim MyGridfunctions As New ProjectNameSpace.Gridfunction
Dim IntNumRows As Integer = MyGridfunctions.NumRowsInGrid(MyDataGrid
Dim MyDataAccess As New DataAccess.DataAcces
If IntRowNum <= IntNumRows The
Call Updatedialogue(StrTypeOfdialogue
ElseIf IntRowNum = IntNumRows Then 'adding a new row
Call Updatedialogue(StrTypeOfdialogue
End I
End Su
Private Sub Updatedialogue(ByVal strtable As String
Dim MyDataAccess As New DataAccess.DataAcces
DirectCast(BindingContext(mydataset.Tables.Item(Orders)), CurrencyManager).EndCurrentEdit(
If MyDataSet.HasChanges The
Call MyDataAccess.UpdateDataSet(MyDataset, MysqldataAdapter, Orders
End I
End Su
'THIS IS WHERE THE ERROR OCCUR
Public Sub UpdateDataSet(ByRef MyDataset As DataSet, ByVal Mysqldataadapter As SqlDataAdapter, ByVal strTable As String
Dim objCommandBuilder As New SqlCommandBuilder(Mysqldataadapter
Tr
Mysqldataadapter.Update(MyDataset, strTable
Catch e As Exceptio
MsgBox(e.Message
End Tr
End Su
Any ideas how to avoid this error, what I'm doing wrong or at least how I can see the actual update command that is been performed, including the values of the parameters. I've tried myadapter.updatecommand.parameters.item(0). etc and is says that the parameters have a value of nothing on both the successfull and non successfull updates
The error only occurs when adding a new row and then adding something in the non-datagrid field rtxtDialog and then clicking on the next row in the grid
Any help would be greatly appreciate
Ger