Visual Basic Reference
VisData (Visdata.vbp)
See Also
This sample program demonstrates various programming techniques used to access data through the Data Access Object (DAO) layer built into the Visual Basic Professional Edition.
Note To access ODBC data sources with this sample, you must first install ODBC using the ODBC setup program provided with Visual Basic, Professional Edition.
VisData behaves like a general purpose database utility, capable of the following functions:
Database and table creation.
Table modification (adding and deleting fields and indexes).
Data browsing/modifying using the three recordset types (table, dynaset, and snapshot) and three form types (single record, data control, and data grid).
Property browsing on all objects.
Form demonstrating the new data-bound list and data-bound combo box controls.
Import/export to all supported data types.
Direct SQL statement execution for any SQL supported functions such as Insert, Update, Delete, Drop, Create, Dump, and so forth.
AdHoc Query builder that helps users unfamiliar with SQL to create complex queries with Where clauses, Joins, Order By, and Group By expressions while limiting output to selected columns.
Transaction processing.
Copying table structures and data to the same or different database.
Support of Jet MDB, Dbase III and IV, FoxPro 2.x, Paradox 3.x and 4.x, Btrieve, Text, Excel, and SQL Server, both DDL and DML.
QueryDef creation, modification, and execution.
JET security creation/modification.
Relation/referential Integrity creation and modification.
Management of attached tables.
Use as an add-in to Visual Basic (see VISDATA.TXT).
The code contains comments to help explain the use of the various methods in the data access layer. Code and forms may be copied from this application to other applications with minimal modification.
File | Description |
Aboutbox.frm | Standard About box for the application. |
Addfield.frm | Form to add fields to tables. |
Addindex.frm | Form used to add indexes to Tables. |
Attach.frm | Attached table list. |
Cpystru.frm | Form to copy table structures. |
Database.frm | Form to select a database. |
Dataform.frm | Data control form. |
Datagrid.frm | Form used to display data in a data-bound grid control. |
Datatype.frm | Data type selector for import/export utility. |
Dbpwd.frm | Form to enter a password. |
Dcprop.frm | Data control property form. |
Dfd.frm | Data Form Designer add-in form. |
Dynasnap.frm | Form to display data in single-record mode. |
Errors.frm | Errors collection form. |
Expname.frm | Export name prompt. |
Find.frm | Form used to find records in a Dynaset. |
Grpsusrs.frm | Jet security form. |
Imptbls.frm | Import tables list. |
Join.frm | Form used to add joins to the Query Builder. |
Loginfrm.frm | Jet WorkSpace logon dialog box. |
Newattch.frm | New attachment form. |
Newpw.frm | New password dialog. |
Newug.frm | New User/Group dialog. |
Odbclogn.frm | ODBC logon form. |
Property.frm | Property browser. |
Query.frm | Form used to build queries. |
Replace.frm | Form to perform global replace operations on a table. |
Seek.frm | Form used to get input for the Seek function. |
Sql.frm | Form to enter and execute SQL statements. |
Tableobj.frm | Form used to display data in a Table object. |
Tblstru.frm | Form to display and modify table structures. |
Vbimex.frm | Import/export form. |
Vdclass.cls | Class module for VisData. |
Vdmdi.frm | Main MDI form for the application. |
Visdata.bas | Support functions for the application. |
Visdata.vbp | Project file for the application. |
Zoom.frm | Form to zoom in on character data. |
Vb5.hlp | VisData Help File. |
*.frx files | Contains binary data for the associated .frm File. |
*.ico files | Supplied for modification by user. |
To Run
On the File menu, click Open Project, and select the Visdata.vbp file, which is located in the Samples directory.
If you want to open a local database, you simply need to choose the type of database, and a File Open dialog box will be displayed with the file type set to the requested data file type.
If you choose ODBC on the Open Database submenu, you will then see the Open DataBase form. Since you probably have no servers entered, you will need to enter a name for an existing SQL server on your network. If you already know the user ID and password, you can add them as well. The Database name is optional. Once you have entered this data, choose OK, and you should be able to log on to the server. You may get some more dialogs in the process. Answer any questions you can and ask the SQL administrator for help if you run into problems or don't know some of the parameters.
Once a database is open, double-clicking a table name will open the table in the selected form type and recordset type. Use the Query Builder to create dynasets with selected data from one or more tables at a time.
The table-type Recordset is always updatable. The dynaset-type Recordset will be updatable in most cases except on ODBC with no unique index, certain multiple table joins, and other SQL Select statements, such as count(*), max(), and so forth. The snapshot-type Recordset is never updatable.