Talk about VB database programming methods

zhaozj2021-02-11  268

Talking about VB's database programming method VB full name Visual Basic, is a Basic language-based visual programming environment launched by Microsoft, which is favored by the majority of computer enthusiasts. VB's database programming can be divided into three categories according to its difficulty; ● Use database control items and binding control items ● Programming using database object variables ● Direct calls ODBC2.0API in using VB When programming, usually, one of the three basic methods will be selected to perform the scheme design of the database application, and the adaptation range of the above three design methods and its advantages and disadvantages are now compared. 1 Using Database Control Items and Binding Control Item 1.1 Advantages  It is a minimum code amount in three ways. You don't have to know the details of CDBC2.0API to allow the use of standard and third-party manufacturers to simplify the error handling. Support all Dynamic Set Methods and Properties 1.2 Disadvantages  You cannot access snapshot objects (Snapshop) objects or table objects (all recorded objects)  You cannot access database sets, such as table definition (tablededefs), index ( Indexes and query definition (querydefs)  You can only access some ODBC2.0 management functions  Can't perform real transaction processing  limited error diagnostic feature 1.3 Application  to small and medium-size database tables (usually less than one thousand records) Only the result set of the basic SQL query is limited in the basic SQL query (the number of records of the normal result set is less than one hundred, these records are retrieved from one or two lengths)  Application data input / There are fewer outputs (usually only involve one or two lengths limited tables, and the number of fields in the table is about 10 or so and does not have relationship integrity limit 2 using database object variables 2.1 advantages can access ODBC2 in the program. The management function of .0 can control a variety of recorded categories: Dynaset, SnapShop, and Table record set objects Access stored procedures and query actions can access database set objects, such as Tabledefs, Fields, Indexes, and QueryDefs have real transaction power. , Including starting transactions, commit transactions, and rollback transactions (COMMITTRANS) and rollback transactions (COMMITTTRANS) and rollback transactions (COLLBACK) 2.2 Disadvantages can only perform indirect error handling and error recovery than using data control items. The granular control has a limited performance of the results set and the operation of the end of the result set, which is limited to the method directly using the ODBC2.0API function. 2.3 Application applications need to create tables, fields and index applications during execution Transaction applications involving synchronous updates (but logically consistency) use result set instead of Dynaset form, such as Snapshots or Tables, here is a key application to consider key applications. Large, more than 1000 record applications have complex data input / output, which involves many internal related fields and includes database reference integrity or consistency rule applications need to perform some additional operations and query on the results set. Processing, especially if there is a high data format display  Application requires the use of complex ODBC management functions to select, configure, verify, and build various data sources. Applications need to "display" the basic structure of the database during execution. application The program needs to retrieve or update records using complex multi-code indexes 3 Direct calls ODBC2.0API3.1 Advantages  You can directly participate in the development, management and standardization of results set, provide more control over the result set target, and provide More cursor types and execution action  can determine that ODBC drivers and SQL consistency level  can better control Windows execution scheduling and resource utilization  other aspects are similar to other methods, so this method is likely to have the best Performance 3.2 Disadvantages The other two methods require a large number of code  code complicated and require the programmer to have an experience in which the API call is written. The error handling of the Visual Basic running period is lacking security, so the error during code is running. The consequences of the cause will be very serious 3.3 Application  If the system environment is a large-scale multi-user environment in client / server mode, the application must accurately resolve the possible system errors and failure applications to emphasize resource usage. Here, how to directly control memory, web server resources is the primary consideration. The application uses a large-scale database, such as database tables, may contain tens of thousands or hundreds of thousands of records.

转载请注明原文地址:https://www.9cbs.com/read-3908.html

New Post(0)