About VB Database Programming

Source: Internet
Author: User
Tags table definition

About VB Database Programming

Visual Basic (VB) is a visual programming environment launched by Microsoft based on the basic language. It is favored by many computer enthusiasts for its simple and powerful functions.
VB Database programming can be divided into three categories (from easy to difficult) based on their difficulty level );
● Use Database Control items and bind control items
● Programming with database object variables
● Directly call the odbc2.0api
When using VB for database programming, we usually select one of the three basic methods to design the database application solutions, now we will compare the adaptation scope and advantages and disadvantages of the above three design methods.
1. Use Database Control items and bind control items
1.1 advantages
It is the least encoded among the three methods.
No need to know details about the cdbc2.0api
Allow the use of standard and third-party vendor-developed controls
Simplified error handling
Supports all dynamic set methods and attributes
1.2 disadvantages
You cannot access snapshot objects (snapshop) or table objects (all belong to record set objects)
You cannot access a database set, such as a table definition (tabledefs) field (fieds), an index (indexes), or a query definition (querydefs)
Only some odbc2.0 management functions can be accessed
Cannot perform real transaction processing
Limited error diagnosis Functions
1.3 applications
For small and medium-sized database tables (usually less than one thousand records), you can only browse the summary.
The length of the result set corresponding to a basic SQL query is limited (generally, the number of records in the result set is smaller than one hundred, and these records are retrieved from one or two tables with limited length)
There are few data input/output items in the application (usually only one or two tables with limited length are involved, and the number of fields in the table is about 10, and there is no link integrity limit
2. Programming Using database object variables
2.1 Advantages
Odbc2.0 management functions can be accessed in a program
Multiple record set types can be controlled: dynaset, snapshop, and table record set object
Allows you to access stored procedures and query actions.
You can access database collection objects, such as tabledefs, fields, indexes, and querydefs.
Real Transaction processing capabilities, including Start transaction (begintrans), commit transaction (committrans), and rollback transaction (rollback)
2.2 disadvantages
It is more encoded than the Data Control item method.
Only Indirect Error Handling and error recovery are allowed.
No fine-grained control over each database operation
Operations on inabundant Resources in the result set and result set are restricted.
Compared with the method that directly uses the odbc2.0api function
2.3 Applications
The application needs to dynamically create tables, fields, and indexes during execution.
Applications involve complex transactions that synchronously update several tables (but logically maintain consistency)
Applications use result sets instead of forms of dynaset, such as snapshots or tables. This is the key to design.
The application has a very large table with more than 1000 records.
Applications have complex data input/output items that involve many internal related fields and include database integrity or consistency rules.
The application needs to perform some additional operations and query and post-processing of the result set, especially for formatting of high data.
Applications need to use complex ODBC management functions to select, configure, verify, and create various data sources.
The application needs to "display" the basic structure of the database during execution
Applications need to use complex multi-code indexing methods to retrieve or update records.
3. directly call the odbc2.0api
3.1 advantages
You can directly participate in the development, management, and standardization of result sets.
Provides more control over the result set cursor, and provides more cursor types and execution actions.
Determine the consistency level of ODBC drivers and SQL
Better control of Windows execution scheduling and resource utilization
Similar to other methods, this method may have the best performance.
3.2 disadvantages
A large amount of code is required compared with the other two methods.
The code is complex and requires programmers to have experience in programming API calls.
On the network, there is a lack of security for library error handling during visual basic runtime. Therefore, errors during code runtime may cause serious consequences.
3.3 applications
If the system environment is a large-scale multi-user environment in Client/Server mode, the application must be able to accurately solve possible system errors and failures.
The application emphasizes resource usage. How to directly control memory and network server resources is the primary consideration.
Applications use ultra-large-scale databases. For example, database tables may contain tens of thousands or hundreds of thousands of records.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.