home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / dbmsg / sql / vbsql / readme.txt < prev    next >
Encoding:
Text File  |  1996-04-03  |  8.5 KB  |  188 lines

  1. ****************************************************************
  2.                 MICROSOFT SQL WORKSTATION 6.0
  3.           DB-LIBRARY FOR VISUAL BASIC SAMPLE PROGRAMS
  4. ****************************************************************
  5. This file tells about the DB-Library for Visual Basic sample
  6. programs included with Microsoft(R) SQL Workstation 6.0. The
  7. information in this file supplements the information in your 
  8. Microsoft SQL Workstation documentation.
  9.  
  10. ****************************************************************
  11. DB-LIBRARY FOR VISUAL BASIC SAMPLE APPLICATIONS
  12.  
  13. DB-Library for Visual Basic provides a set of sample applications
  14. that demonstrate the use of many DB-Library for Visual Basic functions
  15. and routines.
  16.  
  17. You can use the code in these sample applications as models or
  18. templates for your own applications. By cutting and pasting code from
  19. specific application files, by using global procedures from the sample
  20. common code files, and by including the declarations for those
  21. procedures from the sample include files, you can quickly create the
  22. foundation for your own applications.
  23.  
  24. The QUERY sample application demonstrates the following SQL Server 
  25. operations. Each sample:
  26. * Logs in and opens a connection to SQL Server from the client.
  27. * Allows a user to choose which database to use.
  28. * Allows the user to send a query to SQL Server.
  29. * Accepts results from SQL Server and returns the results to the user.
  30. * Closes the SQL Server connection.
  31. * Exits the application.
  32. * Handles any errors or messages generated by these operations.
  33.  
  34. The rest of this file describes the contents of all of the Project
  35. files used by the QUERY sample application. This information is
  36. organized by the names of the subdirectories in which each Project
  37. file resides.
  38.  
  39. Once you are familiar with the QUERY sample applications and their
  40. use of the common code directories, refer to the other sample
  41. applications provided for examples of implementing additional
  42. SQL Server features.
  43.  
  44. COMMON CODE
  45.  
  46. The files in the subdirectory DBLIB\VSAMPLES\COMMON contain general
  47. code that can be used by all DB-Library for Visual Basic applications.
  48. The QUERY sample application include all of the COMMON files with 
  49. their Project files and invoke the procedures that these files contain.
  50. The following sections describe the files contained in the COMMON
  51. subdirectory.
  52.  
  53. The VBSQLGEN.BAS File
  54. The VBSQLGEN.BAS module defines a set of procedures that perform tasks 
  55. common to most DB-Library for Visual Basic applications. Such tasks
  56. include:
  57. * Opening and closing a SQL Server connection
  58. * Processing SQL queries 
  59. * Executing SQL commands 
  60. * Displaying error messages 
  61.  
  62. The LOGIN.FRM File
  63. The LOGIN.FRM file calls a subroutine in the VBSQLGEN.BAS module that
  64. uses DB-Library for Visual Basic functions to open a SQL Server
  65. connection and log in users. The code for logging in users is used in
  66. all of the sample applications except the browse-mode example.
  67.  
  68. The CHNGDB.FRM File
  69. The CHNGDB.FRM file uses the DB-Library for Visual Basic function
  70. SqlUse% to change the current database to a database name supplied
  71. by the user. The code for changing databases is used in all of the
  72. sample applications.
  73.  
  74. THE WINCODE DIRECTORY
  75.  
  76. The files in the DBLIB\VSAMPLES\WINCODE subdirectory contain code
  77. that is available for use by all applications. To use the common code,
  78. you can add the files to a Visual Basic Project or you can copy the
  79. code from these files into an existing file. The following sections
  80. describe the files in the WINCODE subdirectory.
  81.  
  82. INIEXITW.BAS
  83. INIEXITW.BAS contains DB-Library initialization and exit code.
  84.  
  85. RESULTSW.BAS
  86. RESULTSW.BAS contains procedures for handling compute rows and stored 
  87. procedure output parameters. These procedures are called by the 
  88. Process_Sql_query procedure defined in VBSQLGEN.BAS.
  89.  
  90. THE VBQUERY DIRECTORY
  91.  
  92. The directory DBLIB\VSAMPLES\QUERY include the project make file for
  93. the sample application and the sample application's primary, or
  94. startup, form, VBQUERY.FRM.
  95.  
  96. VBQUERY.BAS and VBSQL.BAS
  97. VBQUERY.BAS and VBSQL.BAS contain the global definitions for this 
  98. application. They include the relevant variable definitions from
  99. GENGLOB.BAS. These are required. The VBSQL.BAS file contains the
  100. global definitions for VBSQL functions and constants.
  101.  
  102. ADDITIONAL SAMPLE APPLICATIONS
  103.  
  104. This section provides information about some of the other
  105. DB-Library for Visual Basic sample applications provided in your
  106. package.
  107.  
  108. The TEXT Sample Application
  109. The TEXT sample application enables users to select text files from
  110. a database, and view and edit the text in the text file.
  111.  
  112. The TEXT.FRM file of the TEXT project contains the code of the main
  113. form of the application. It includes subroutines for selecting, 
  114. retrieving, and editing text files. For example, the LoadText
  115. subroutine contains DB-Library for Visual Basic functions that read
  116. text fields from database tables; the InsertText subroutine contains
  117. DB-Library for Visual Basic functions that insert text into database
  118. text tables.
  119.  
  120. The IMAGE Sample Application
  121. The IMAGE sample application enables users to select image files from
  122. a database, view images, and add images to a database. It looks and
  123. works much like the preceding TEXT sample application.
  124.  
  125. The IMAGE.FRM file of the IMAGE project contains the code of the
  126. main form of the application. It includes subroutines for selecting,
  127. retrieving, and adding image files. For example, the LoadImage 
  128. subroutine contains DB-Library functions that read images from 
  129. databases; the InsertImage subroutine contains DB-Library functions
  130. that insert images into databases.
  131.  
  132. The BROWSE Sample Application
  133. The BROWSE sample application demonstrates the use of DB-Library
  134. for Visual Basic browse-mode functions. The BROWSE project uses the
  135. common code files VBSQLGEN.BAS and ABOUT.FRM. The code from the
  136. GENGLOB.BAS file is included in the BROWSE.BAS global file.
  137.  
  138. The BLOGIN.FRM file includes the code from the common code file
  139. LOGIN.FRM. However, because the browse mode requires two SQL Server
  140. connections, the code to open a connection is repeated. The
  141. OK_BUTTON_Click subroutine of the BLOGIN.FRM file illustrates the
  142. correct way to open SQL Server connections for browsing.
  143.  
  144. The BROWSE.FRM file of the BROWSE project contains the code of
  145. the main form of the application. It includes subroutines for
  146. selecting, retrieving, and updating rows of information. For example,
  147. the Select_Button_Click subroutine sends a command to query
  148. SQL Server and processes the results of the query; the 
  149. Update_Button_Click subroutine sends a command to update or change 
  150. information in results rows; the ProcessResultRow subroutine 
  151. processes the data in a results row. This subroutine is used in 
  152. the Select_Button_Click subroutine mentioned previously.
  153.  
  154. The CURSORS Sample Application
  155. The CURSORS sample application illustrates the use of cursors in
  156. DB-Library for Visual Basic applications. The CURSORS project uses
  157. the common code files VBSQLGEN.BAS, and LOGIN.FRM. The code from 
  158. the GENGLOB.BAS file is included in the CURSORS.BAS global file.
  159. The CURSORS.FRM file of the CURSORS project contains the code of 
  160. the main form of the application. It includes subroutines for 
  161. opening and closing cursors, fetching rows of data, updating rows, 
  162. and displaying rows.
  163.  
  164. The RPC Sample Application
  165. The RPC sample application shows the use of SqlRpcSend% and related
  166. calls. This sample invokes stored procedures directly (not through
  167. a language command) and retrieves return status and output 
  168. parameters. Direct invocation of stored procedures is especially 
  169. useful with Open Data Services applications. The sample also shows
  170. the use of SqlServerEnum% for listing available servers.
  171.  
  172. The RPC sample application contains most of the stored procedure
  173. calls in the RPC.FRM module. The RPCLOGIN.FRM file shows the use of 
  174. SqlServerEnum%. RPC return status and output parameter handling are 
  175. covered in RESULTSW.BAS, called by the Process_Sql_query function 
  176. in VBSQLGEN.BAS.
  177.  
  178. The PUBS Sample Application
  179. The PUBS sample application is a full-featured application showing
  180. how many VBSQL functions can be combined into a business application.
  181. This sample shows a data entry and query form for the authors in 
  182. the pubs database. It illustrates the use of a list box for 
  183. maintaining a key set of records, browse mode for optimistic 
  184. concurrency, and building SQL statements based on data entered.
  185. It also shows techniques for using Visual Basic features such as 
  186. MDI child windows and grid controls within an application.
  187.  
  188.