Summary of Tips to Improve Data Access Speed in VB version 3.0

ID: Q120172


The information in this article applies to:


SUMMARY

This article summarizes the techniques for improving the speed of data access in your database applications. There are four main points that will be covered in this article:


MORE INFORMATION

Transactions

Implementing transactions can be the most significant way to increase the speed of data access in your database application. This technique is ideal for speeding up inserting, updating, appending, or deleting data in a database. In a nutshell, transactions cache a group of operations in memory, then commit them all at once rather than committing each individual operation. They also provide a means for discarding the proposed changes (rollback).

For additional information, please see the following articles in the Microsoft Knowledge Base:
Q109830 : How to Speed Up Data Access by Using BeginTrans & CommitTrans

For ODBC sources, however, transactions do have their limitations as outlined in the following article:
Q101518 : Transactions on ODBC Data Sources in Visual Basic Version 3.0

Attached Tables

Using attached tables increases performance most when connecting to ODBC databases such as Microsoft SQL Server, Oracle, and Sybase. With attached tables, information on the table structure is cached in the Microsoft Access database.

This technique increases performance when connecting to the ODBC data source because you eliminate the overhead of Visual Basic querying the ODBC data source for this table structure information.

For additional information, please see the following articles in the Microsoft Knowledge Base:
Q108423 : How to Attach an External Database Table to a VB 3.0 Database

Q90100 : PRB: Remote ODBC Tables Are Read-Only Without a Unique Index

ODBC: DB_SQLPassThrough and ExecuteSQL

If you do not use attached tables to connect to your ODBC data source, you can use the DB_SQLPassThrough flag when creating recordsets to increase performance. For action queries such as Insert, Delete, and Update that take action rather than returning records, you can use the ExecuteSQL method. By using DB_SQLPassThrough and ExecuteSQL, you increase performance by delegating execution of the SQL query to the client-server database via the ODBC connection. There are some limitations, however, when using DB_SQLPassThrough. Most notably, the recordset returned is Read-Only.

For additional information, please see the following articles in the Microsoft Knowledge Base:
Q106492 : How to Call SQL Stored Procedures from Visual Basic

Q115237 : How to Use Temporary Tables in SQL Server from Visual Basic

Q106111 : PRB: Illegal to Use Find Methods w/ SQL PASSTHROUGH & ODBC DB

Q103976 : FIX: Invalid Argument Err on Execute Method w/SQL Passthrough

Correct Use of the Data Access Object (DAO) Variable

You can also increase performance by using the correct data access object variable(s) for your needs. To do this, you need to understand the functionality of each of the different DAO variables. Below is a brief outline of the seven main advantages and disadvantages of each of the data access object variables and the data control.

Table Object:
Dynaset Object:
Snapshot Object:
Data Control:
For additional information, please see the following articles in the Microsoft Knowledge Base:
Q103442 : Differences Between the Object Variables in VB Version 3.0

Q109218 : Using Table Objects Versus Dynaset/Snapshot Objects in VB

Q103808 : Limitations of the Data Control in Visual Basic Version 3.0

Additional query words: 3.00 Speed fast faster


Keywords          : 
Version           : 
Platform          : 
Issue type        : 

Last Reviewed: May 28, 1999