MDAC 2.5 SDK - ODBC Samples


 

Admin Demo Sample

Admin Demo uses the ODBC API to enable you to connect to a data source, execute SQL statements, run scripts, and perform other special tasks. In addition, Admin Demo can list information (such as data types, functions, and general ODBC information) about the data source being used.

Note   Admin Demo is provided as a sample. It is not designed to replace proprietary DBMS tools, because there are some tasks that can be done only with DBMS-specific tools. Instead, Admin Demo and its sample code are supplied as an example of how to write a general-purpose, ODBC-enabled application for performing system operations on different data sources.

Features

Connection Windows

Admin Demo enables you to connect to multiple data sources. The only limits on connections are those imposed by each driver and the amount of memory available on the system. Each new connection creates a multiple-document interface (MDI) child Connection window from which SQL statements can be executed.

Input and Output Windows

The Connection window contains two panes. The input (upper) pane enables you to edit a file, enter new statements, and execute those statements. The output (lower) pane is used to log error and diagnostic messages.

To toggle between the input and output panes, press F6. If a Results window is currently active, pressing F6 causes the cursor to activate the Connection window that owns that Results window.

Results Windows

The output from operations that produce result sets, such as executing SQL statements or invoking ODBC catalog functions, is displayed in a Results window. Each Results window is an MDI child window of the Connection window in which the operation was performed. This means that disconnecting from a Connection window closes all Results windows created from that Connection window.

Limitations

Admin Demo is a useful sample application, but not a polished product. It is up to you to improve its performance and functionality. You should be aware of the following limitations.

Maximum Rows Fetched in a Result Set: 1000

The maximum number of rows that can be fetched in a result set is 1000. Each fetched row is placed in a structure that is added to an owner-drawn list box. Because the operating system limits the number of elements in a list box to 1000, Admin Demo cannot handle more records than this limit.

Simplistic Memory Management

The memory management scheme used in Admin Demo is also very limited. When Admin Demo needs memory, it calls GlobalAlloc. This is not the most efficient method because it can cause memory fragmentation and poor performance.

No Asynchronous Operation

Admin Demo does not take advantage of the asynchronous capabilities of some ODBC drivers. It executes a query and fetches the result set synchronously, limiting performance for long queries.

Other Limitations