Non-database recordset & DataGrid: help needed

Vlad
07-18-2000, 12:54 PM
Hi. In a project I am currently working on I have a data source which is not a common-type database. I created an encapsulated class by using the ADODB.Recordset and bound it to the DataGrid control at run-time.

Everything works just fine: it lets me add/modify the data in the grid BUT I need to be able to actually UPDATE my external data source when the corresponding recordset is updated through the Grid. The actual updating of the data file is done by 3 different external functions: AddRow, ModifyRow, DeleteRow.

The datagrid AfterUpdate and BeforeUpdate events don't help much as they do not distinguish the 3 operations, i.e. you don't know whether the Update was initiated by adding,modifying or deleting a row.

I am not happy to think of tracing all possible keypress events to be able to handle that situation. There must be a more beautiful way to solve the problem. Maybe there're any hints/ideas on that matter? Maybe there're other grid-type controls available that take care of that?

Thanks,

PendulumMan
11-07-2000, 01:59 PM
I think you could use the BeforeInsert and BeforeDelete event to your advantage. I.E.:

Private sAction as string

private sub BeforeInsert()
sAction="I"
end sub
Private Sub BeforeDelete
sAction = "D"
end sub
Private AfterUpdate()
If sAction = "I" then <<dowInsert stuff>>
elseif sAction = "D" then << do delete stuff>>
else <<do modify stuff>>
sAction=""
end sub

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum