home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 11 / CDACTUAL11.iso / cdactual / demobin / share / os2 / VPREVAL / DATAMAIN._ / FORM.1 < prev    next >
Encoding:
Text File  |  1995-05-02  |  2.8 KB  |  57 lines

  1. Arg window
  2.  
  3. /************************************************************/
  4. /* DATABASE SAMPLE                                          */
  5. /*                                                          */
  6. /* This sample program requires the installation of OS/2    */
  7. /* Database Manager, or DB2/2.                              */
  8. /*                                                          */
  9. /* To successfully run this sample you must first create    */
  10. /* a simple database.  This can be done by using Query      */
  11. /* Manager, if you desire.                                  */
  12. /*                                                          */
  13. /* This program uses a single database called DBSAMPLE with */
  14. /* the USERID qualification.  There is only one table in    */
  15. /* this database, with the name CUSTOMER.                   */
  16. /*                                                          */
  17. /* The CUSTOMER table used for this example should be       */
  18. /* created as follows:                                      */
  19. /*                                                          */
  20. /*    Column name        Type           Length   Attributes */
  21. /* ----------------   ----------------  ------   ---------- */
  22. /* CUST_CUSTOMER_ID   Large Integer               Required  */
  23. /* CUST_NAME          Character(Fixed)    40      Text      */
  24. /* CUST_COMPANY       Character(Fixed)    40      Text      */
  25. /* CUST_ADDRESS       Character(Fixed)    40      Text      */
  26. /* CUST_CITY          Character(Fixed)    25      Text      */
  27. /* CUST_STATE         Character(Fixed)    3       Text      */
  28. /* CUST_ZIP           Character(Fixed)    10      Text      */
  29. /* CUST_COUNTRY       Character(Fixed)    25      Text      */
  30. /* CUST_PHONE         Character(Fixed)    15      Text      */
  31. /*                                                          */
  32. /************************************************************/
  33.  
  34. TITLE = 'DataBase Sample'
  35. CALL VpWindow window,'SETTITLE',TITLE
  36.  
  37. /* Set item font CUSTLIST List Box */
  38. CALL VpItem window,'CUSTLIST','FONT','10.System Monospaced'
  39.  
  40. /* Register The External Routines SQLEXEC (Supports the SQL Language) and  */
  41. /* SQLDBS (Supports Database Manager Routines)                             */
  42. rcy = rxfuncadd( 'SQLDBS', 'SQLAR', 'SQLDBS' );
  43. rcy = rxfuncadd( 'SQLEXEC', 'SQLAR', 'SQLEXEC');
  44.  
  45. /* Initialize database manager */
  46. call SQLDBS 'START DATABASE MANAGER'
  47.  
  48. if SQLCA.SQLCODE <> 0 & SQLCA.SQLCODE<>-1026 then do
  49.    response=VpMessageBox(window,TITLE,'Error starting DataBase Manager.  SQLCODE = 'SQLCA.SQLCODE'. You need to have DB2/2 installed to run this sample.')
  50.    CALL VpWindow window,'CLOSE'
  51. end
  52. /* Add item sorted ascending CUSTLIST List Box */
  53. CALL VpAddItem window,'CUSTLIST','ASCENDING','<NEW CUSTOMER>'
  54.  
  55. /* Select item CUSTLIST List Box */
  56. CALL VpSelect window,'CUSTLIST',1,1
  57.