Hola,
Cojo los datos de una base de datos, y los pongo en un datagrid.
Lo que quiero hacer, es que , cuando modifique los datos en el datagrid, tb se me guarden en la base de datos. Mi codigo es el siguiente.
Dim lsCadena As String
Dim lDataAdapter As OleDbDataAdapter = New OleDbDataAdapter
Dim DSCambios As DataSet = New DataSet
Dim lOCB As OleDbCommandBuilder
Dim pConexionOledb As OleDbConnection
lsCadena = "Provider=Microsoft.jet.oledb.4.0;Data source=" & "c:\PedidosWeb.mdb"
pConexionOledb = New OleDbConnection
pConexionOledb.ConnectionString = lsCadena
lOCB = New OleDbCommandBuilder(lDataAdapter)
lDataAdapter.SelectCommand = New OleDbCommand
lDataAdapter.SelectCommand.Connection = New OleDbConnection
lDataAdapter.SelectCommand.Connection.ConnectionSt ring = lsCadena
lDataAdapter.SelectCommand.Connection.Open()
Try
lDataAdapter.UpdateCommand = lOCB.GetUpdateCommand
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information)
End Try
lDataAdapter.Update(DSCambios.Tables("MaestroClien te"))
lDataAdapter.SelectCommand.Connection.Close()
'DSCambios.AcceptChanges()
Me.grdrevisar.DataSource = DSCambios
Me.grdrevisar.DataBind()
Return DSCambios
me da error en, lDataAdapter.UpdateCommand = lOCB.GetUpdateCommand.
A ver si alguien sabe como solucionarlo