I am a self taught programmer who started programming with VB6 several years ago and have been using classes for all I/O to the database. I have been tempted several times to just use the ADO data control from the form, especially when using a grid or spreadsheet control. I like the idea that all I/O for a table is maintained in one place and used on many forms, but sometimes it also seems like it is more work than really necessary. Are there any guidelines on this subject? I have read many books, but they do not generally discuss how things are done in a 'real world' programming environment. I realize that there are more considerations than the simplified question I have asked, but I would appreciate any input. Thanks.In VB6, Is using a class module better for connecting to a database than using an ADO control from a form?
In the ';real world';, the data presentation is in one tier, the business logic is in another tier, and the database access is in a third tier.
If the business decides to switch database packaged (like, go from SQL Server to Oracle), and you have your forms going directly to the data source, then you may have to change all your forms.
In a multi-tier environment, you never touch the forms, and only change your business logic piece.
So, if you would code your forms to access the class, and compile the class separately (maybe as a Component), and do all database access from it, then you are DEFINITELY closer to the real-world implementation.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment