|
-
Aug 15th, 2001, 01:59 PM
#1
Thread Starter
Addicted Member
Referencing records in a DLL (ADO)
Hi,
I want to write a DLL that will wrap a database's tables and records (with classes and properties respectively), but I don't know what is the best method to update the database when a record changes...
I guess I have 3 options:
1. Each class will have it's own recordset that points to the physical record on the DB (although this could be an important performance hit when there are thousands -or more- records)
.
2. Since each record has a unique id, I could store this id with each class, so when I need an update, I execute a "SELECT * FROM <table> WHERE <id> = <storedid>" and update the resulting record.
3. Create a general purpose function that will take as parameters the table name, the record id, and the columns with their values... And update the record accordingly.
What would be the better approach? Are there any other approachs?
Also, Is there a way to know when a record changes? This way I can cache the read records in memory, and update them only when the db changes...
Thanks in advance!
-
Aug 15th, 2001, 03:18 PM
#2
New Member
I like option number 3. For me I it's easier to create one routine and specifying the information for each.
I would also suggest that you use client side cursors and batch updates to reduce the performance issues.
This would also allow you to open multiple recordsets perform work on each and then update all at one time without keeping the connection open.
Hope this helps,
triley
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
|