VB6 DataGrid Control :- Populating Editing and saving data back to Oracle
Hi All
I am using VB6 with oracle back ground
I am able to display the data in the datagrid (microsoft datagrid control 6.0).
now
I am required to allow user to edit only third column in the grid(i.e other than 3rd col all are not editable.) and save the edited row back to database.
I am not getting how to do that. Please help, Please its urgent
an example code will be a good help
Thanks in advance
Re: VB6 DataGrid Control :- Populating Editing and saving data back to Oracle
Quote:
an example code will be a good help
an example of the code you have now, to populate the datagrid, would be a good start for getting help
Re: VB6 DataGrid Control :- Populating Editing and saving data back to Oracle
I used following code to fill datagrid
vb Code:
Public con As ADODB.Connection
Public rs As ADODB.Recordset
Set con = New ADODB.Connection
con.Open "Provider=msdaora;Data Source=database;User Id=uid;Password=pwd;"
Set rs = New ADODB.Recordset
strSQL = "SELECT * FROM table_name"
rs.CursorType = adOpenStatic
rs.CursorLocation = adUseClient
rs.LockType = adLockOptimistic
rs.Open strSQL, con, , , adCmdText
If rs.RecordCount > 0 Then
Set DataGrid1.DataSource = rs
Else
MsgBox "No Record Found. Please Check "
rs.Close
End If
with this code i m able to get data in datagrid.
Re: VB6 DataGrid Control :- Populating Editing and saving data back to Oracle
if you edit a row in the datagrid, you would need to find the correct record in the recordset (rs) and then edit that record, change the value of the appropriate field then update
either declare rs at global level and leave open, close when closing program, or keep opening recordset each time