edit records in a datagrid
I have a datagrid on a windows form.
I want to set the datasource on load , its a a table in oracle, allow user to view rows and edit them,
Is there any simple code to do this?
Here is come code, this will display my data fine in the grid, but when it comes to editing im lost. I just want the user to be able to edit each row, only certain fields and save:
Private Sub frmRates_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
fvLoadRates(Me.grdExch)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Sub fvLoadRates(ByVal obj As Object)
Try
Dim objcnToDB As New db (have a separte connection object)
Dim cn As OleDbConnection
cn = objcnToDB.Connect
Dim sSql As String
sSql = "select field1, field2 from tblrates"
da = New OleDbDataAdapter(sSql, cnBTMS)
Dim CmdData As OleDbCommand = New OleDbCommand(sSql, cn)
Dim ds As DataSet = New DataSet
da.Fill(ds, "Exch")
grdExch.SetDataBinding(ds, "Exch")
objcnToDB.Disconnect(cn)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
__________________
Thank You
|