QuryDemo: MDI Multi-database Query Sample

Click to open or copy the files for the QuryDemo sample.

Demonstrates a simple MDI (Multiple Document Interface) application that allows a user to simultaneously connect to multiple heterogeneous databases and perform SQL queries to get results. The application uses MDI Child Window Titles to store values of connected SQLHDBCs and SQLHSTMTs. These values are also stored in the combo boxes that are displayed on the toolbar.

Functions in Main.c:

Function Description
WinMain Main routine.
MainWndProc Processes Main Application Window messages.
MDIChildProc Processes MDI child window messages.
ToolbarProc Processes tool bar messages.
StatusbarProc Processes status bar messages.
ConnectDlgProc Processes Connection dialog box messages.
DisconnectDlgProc Processes Disconnect dialog box messages.
AboutDlgProc Processes messages for the About dialog box.
MDIChildDlgProc Processes messages for the dummy child dialog box in an MDI child window.
DrawBitmap Draws bitmaps for toolbuttons.

Functions in Query.c:

Function Description
InitSQLEnvironment Initializes the ODBC library.
DisplayDatabases Displays available data sources.
ConnectDatabase Connects to a specific data source.
DriverConnectDatabase Connects through driver specific dialogs.
DisplayConnections Displays a list of made connections.
DisplayQueries Displays a list of query handles (hstmts).
NewQueryWindow Opens a new hstmt and updates displays.
ChangeCurrentCursor Changes the current cursor display.
ChangeCurrentQuery Changes the current query display.
DisplayNewCrsrAndStmt Updates cusor and query displays.
FreeConnect Frees a connection.
FreeQuery Frees a query handle.
CloseQueryWindow Closes a query window.
ExecuteQuery Executes a user specified query.
CloseDatabases Checks if all connections are closed.
FreeSQLEnvironment Frees the ODBC library.
DisplayError Displays SQL errors and warnings.

Building SDK Samples

This sample uses the following keywords:

aboutdlgproc; activatewindow; beginpaint; bitblt; bringwindowtotop; changecurrentcursor; changecurrentquery; closedatabases; closequerywindow; connectdatabase; connectdlgproc; conststr; createcompatibledc; createdialog; createpen; createwindow; defframeproc; defmdichildproc; defwindowproc; deletedc; deleteobject; destroyicon; destroywindow; dialogbox; disconnectdlgproc; dispatchmessage; displayconnections; displaydatabases; displayerror; displaynewcrsrandstmt; displayqueries; dptolp; drawbitmap; drawbttnlift1; drawbttnlift2; drawbttnrect; drawtext; driverconnectdatabase; enablemenuitem; enablewindow; enddialog; endpaint; executequery; findwindow; freeconnect; freeprocinstance; freequery; freesqlenvironment; get_wm_command_cmd; get_wm_command_hwnd; get_wm_command_id; get_wm_command_mps; get_wm_mdiactivate_factivate; get_wm_menuselect_cmd; get_wm_menuselect_flags; getcapture; getclassname; getclientrect; getdc; getdlgitem; getdlgitemtext; getlastactivepopup; getmapmode; getmenu; getmenuitemcount; getmenuitemid; getmenustring; getmessage; getobject; getstockobject; getsubmenu; getsyscolor; gettextextentpoint; getwindow; getwindowlong; getwindowrect; getwindowtext; id; initsqlenvironment; invalidaterect; isdialogmessage; isiconic; iszoomed; lineto; loadaccelerators; loadbitmap; loadcursor; loadicon; localtime; mainwndproc; makeintresource; max; mdichilddlgproc; mdichildproc; messagebox; movetoex; movewindow; newquerywindow; openicon; postmessage; postquitmessage; ptinrect; rectangle; registerclass; releasecapture; releasedc; selectobject; senddlgitemmessage; sendmessage; setbkmode; setcapture; setcursor; setfocus; setforegroundwindow; setmapmode; settextcolor; settimer; setwindowlong; setwindowtext; showwindow; sprintf; sqlallochandle; sqlbindcol; sqlclosecursor; sqlconnect; sqldatasources; sqldescribecol; sqldisconnect; sqldriverconnect; sqlexecdirect; sqlfetch; sqlfreehandle; sqlfreestmt; sqlgetdiagrec; sqlgetinfo; sqlnumresultcols; sqlsetenvattr; sscanf; statusbarproc; strcat; strcmp; strcpy; strftime; strstr; time; toolbarproc; translateaccelerator; translatemdisysaccel; translatemessage; updatewindow; winhelp; winmain; wsprintf