EricE
01-04-2001, 01:39 PM
A friend of mine told me that all database access should be done by creating the actual DB calls in a class and then referencing the class as opposed to just calling the DB behind an "update" button. This seems to me that it would create more overhead by having to pass information to and from the class, creating 3 or more objects, etc. Any thoughts?
whelanp
01-05-2001, 06:57 AM
Your friend is spot on.
Having a class to all the Database work can be very neat.
You can switch data access methods very easily DAO, RDO & ADO and your main application will know nothing about it.
You can change the database system your app uses just as easy eg from Access to SQL Server to Oracle by changing code in just one place - the Db class.
In actual usage terms (generally) you just pass the connection string and a SQL statement or stored procedure name to the database class. It does the rest.