HP MPE/iX 6.x Operating System manual Using Visual Basic 4.0 or higher

Page 58

Using ODBCLink/SE With ODBC Applications

ODBCLink/SE Reference Manual

Using Visual Basic (4.0 or higher)

You can use ODBCLink/SE either with VB Database controls or with Database and dynaset variables. In addition, of course, you may call ODBC functions directly from the DLL.

To use VB database controls, define a data control and assign it a Connect property of the form "DSN=HP3000;UID=users;PWD=password" and a RecordSource property of the form "SELECT * FROM TableName". If you want to create a SnapShot (no update) set the Options property to 64 (SQL_PASSTHROUGH). You may then place text controls on the screen, set the DataSource property to the name of the data control, and set the DataField property to the name of the column in the Select statement. When the application is run, it will download all records qualified by the Select statement (or all primary key values, depending on the SQL_PASSTHROUGH option) and display the first record on the screen. You may scroll through the records by using the "Up", "Down", "Top", "Bottom" buttons on the data control.

A second option is to use dynaset variables which gives the program more control, such as for loading a grid with data. Define a database object, assign it Connect and Options properties as above, and open it with an OpenDatabase call, as in SET DBVar=OpenDatabase(...). Then define a dynaset variable (DIM DSVar as DYNASET) and open it with a statement of the form "Set DSVar=DBVar.OpenDynaset (SQLstatement)." If SQL Statement is a Select statement, you can read the results from "DSVar.FieldName" and move to the next record with "DSVar.MoveNext". If SQLStatement is an Insert or Update statement, no results are returned. You can update records with the Update method, and you can get the selection count by calling SQLRowCount or with a query of the form "Select COUNT(*) From Table Where Conditions". To update the table, you will of course need a primary key defined and you will need to disable the SnapShot only button.

A third option is to call ODBC functions directly. Generally you will do an SQLAllocEnv, SQLAllocConnect and SQLDriverConnect to open the database, followed by SQLExecDirect, followed by multiple SQLFetch and SQLGetData calls. If you plan to use SQLBindCol to bind fetch results to local variables you must use the following procedure:

A)Declare strings variables as: Dim mystr as String

B)Initialize your string variables before use: mystr=String(255,0)

C)Use the ByVal keyword when passing the variable to the ODBC driver. Do not use the ByVal keyword in the AlpbBuf@ parameter except for character data, as the goal is to pass the address of the parameter, not the value. Declare SQLBindCol as follows:

Declare Function SQLFindCol Lib Aodbc.dll@ (ByVal hstmt AS long, ByVal col As Integer, By Val wConvType As Integer, lpdBuf As Any, ByVal dwbuflen As Long, lpcbout As Long) As Integer.

 

ODBCLink/SE

48

©M.B. Foster Associates Limited 1995-2000

Image 58
Contents ODBCLink/SETM Limitations on Warranties and Liability Additional features of DataExpress for Client-Server are ODBCLink/SE offers the following featuresSales@mbfoster.com If you require any of the following features Page Page Table of Contents Using ODBCLink/SE With Odbc Applications Appendix B Creating a DBEnvironment Page Overview and Specifications Client Environment Connecting LinkOdbc Compliancy Level Server EnvironmentMicrosoft Odbc Overview HP9000 Server Requirements ODBCLink/SE System RequirementsHP3000 Server Requirements Client RequirementsSQL Commands supported Field types supportedPage $sqlver Verify Software Version NumbersVerify the Connection Assurance Parameters ExitTo start the listener on the HP3000 data base server, enter F1 Open ConfigStarting and Stopping the Listener To start the listener on the HP9000 database server, enterTo stop the listener To determine whether or not the listener job is running# ps -ef grep odbclnse Gather Information Create the DBEnvironmentUsing Reflection software Downloading ODBCLink/SE to the Client PCUsing NS Services Dscopy on the HP3000 Using Arpa Services FTP\ODBCSEnn ftp Server binary Get odbcclnn odbcclnn.exe quit Running the Setup program Extracting the ODBCLink/SE fileSelect Next ODBCLink/SE Foster Associates Limited Page Page ODBCLink/SE Configuring Data Sources Scroll down to ODBCLink/SE-32 Driver ODBC3. Click Finish Usr/users/data/PartsDBE MPE/iX if it is an HP3000 HP-UX if it is an HP9000Setup for MPE/iX Setup for HP-UX Setup Options Select Translator Odbc Translator Successful CompletionMigrating HP Pcapi Data Sources Application Development Using Stored Procedures ?=call owner.procedue ?,?Performance Considerations Turning AutoCommit On/Off Supported Functions =No Timeout default Use Allbase =ON default 0=OFF=All Rows default TimeoutIsolation Levels Supported Data Types SqldecimalDate Sqldate Page Using ODBCLink/SE With Odbc Applications Updating DataUsing Cognos Impromptu Special Notes for Users of Impromptu Viewing the SQL generated by ImpromptuChanging the display format JoinsException tables Joined=T Creating Joins Using Calculated Columns Column3 = .column1 + .Column2Using Lotus 123 Release DN=@ODBC@ DL=@DLODBC@ DD=@All Odbc Sources@Using Microsoft Access ODBCLink/SE ODBCLink/SE Foster Associates Limited Using MS-Query ODBCLink/SE Foster Associates Limited Using Visual Basic 4.0 or higher Example DSN=YOUR DSNUID=USERPWD=PASSWORD Connect Using SQL APIConnect Using Sqlapi in VB Connection ExamplesODBCLink/SE ODBCLink/SE Foster Associates Limited Connecting with DAO’s Open the Table and Enter the SQL QueryConnecting with RDO’s Connecting with ADO’s Troubleshooting Terminating an Odbc ConnectionUsing Microsoft Odbc Test 32-bit To run ODBCTE32.EXEVerifying Software Version Numbers Verifying the Client-Side ComponentsDeleting a Translation DLL ODBCLink/SE Reference Manual Troubleshooting Monitoring ALLBASE/SQL Activity with Sqlmon Using the Host Testing Utility OdbcutseTools on the Database Server Checking the Listener Log File on the HP3000Execute stored procedure SQL UpdateExecute immediate SQL command Display tables and table structuresHost Logging Odbc Call Tracing using Dr. DeeBee Spy Odbc Call Tracing using ODBCLink.LOGTools on the Client PC To turn off logging Log is located in C\WINDOWS\DRDEEBEE.LOGModifying the System Registry and ODBC.INI Files Generated by the 32-bit client DLL Error MessagesGenerated by the ALLBASE/SQL command interpreter Comes from the Winsock driverMaximum number of statements Primary key name returned by SQLStatisticsReading or writing to ALLBASE/SQL LongVarBinary items Insert Into Table Values ..., Blob %$Using the Ansi Character Set ALLBASE/SQL and IMAGE/SQL Restrictions on the Odbc Gram- marUnsupported ALLBASE/SQL and IMAGE/SQL Statements Appendix a Implementation Notes ODBCLink/SE Reference Manual Appendix B Creating a DBEnvironment On the HP3000 Database ServerUp,down,left,right,top,bottom,printn,or end Isql= exit $ csh /usr/lib/allbase/hpsql/sqlsetup On the HP9000 Database ServerODBCLink/SE Appendix C List of Installed Files Bit Driver Client For Windows 95 and GreaterODBCLink/SE Install Disc Windows NT Description Bit Driver Client For Windows NT 4.0 and GreaterODBCLink/SE HP-UX 9.x Host MPE/iX HostHP-UX 10.x and 11.x Host Page How MBF-Console Works MBF-Console IntroductionRunning MBF-Console File Menu Options SetupSet Refresh Interval in seconds Print Configure DSNs... Console Data Sources ConfigurationConnect Menu Options ExitListener Window Connections WindowsConnections Window Server Window ⊗ Stop Logging View Menu Option Window Menu OptionHelp Menu Options Installing MBF-Console for MBF-UDALink This can be done using MS ExplorerODBCLink/SE ODBCLink/SE Foster Associates Limited Select Next ODBCLink/SE Foster Associates Limited When you have decided, press Next ODBCLink/SE Foster Associates Limited Select Finish to complete the Setup Installing MBF-Console for ODBCLink/SE Next ODBCLink/SE Foster Associates Limited 100 Foster Associates Limited ODBCLink/SE Foster Associates Limited 101 102 Foster Associates Limited Page Page Index Index ODBCLink/SE Reference Manual ODBCLink/SE Reference Manual Index Listener Log File HP9000 Using Process Status ps Command ODBCLink/SE Reference Manual Index