-
Jun 30th, 2010, 03:20 AM
#1
Thread Starter
Member
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
-
Jun 30th, 2010, 05:08 AM
#2
Re: VB6 DataGrid Control :- Populating Editing and saving data back to Oracle
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
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Jul 1st, 2010, 12:26 AM
#3
Thread Starter
Member
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.
-
Jul 1st, 2010, 07:02 AM
#4
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
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|