Visual Basic and the HP e3000 Examples 

Visual Data Manager, a free product from Microsoft, can be used to
develop a file maintenance program for an IMAGE/SQL, 
ODBC enabled database in minutes !


  Home
  New
  Site Map
  VB Examples
    Visual Basic Example Intro
  
     ODBC Program Generator
        COM Client/Server and Web
        TurboIMAGE Calls from Win32
  Guest Book
  Email

The problem

If you already have an ODBC enabled TurboIMAGE database, a Visual Basic add-in that comes with Visual Basic 6 either Enterprise or Professional editions can be used to generate a Visual Basic program that performs file maintenance.  

Installation and Configuration

Perhaps the most difficult and time consuming aspect of “new technologies” is getting the environment properly configured.   Think of it this way, 15 years ago (and even today), a COBOL programmer working on an HP 3000 (that’s what the called them in those days) could expect to receive a new computer, have it installed be able to develop terminal-based applications within minutes of getting a logon account and password.   The base computer can be ordered with a COBOL compiler and the “installation process” typically assures that certain functionality is available immediately. 

Now consider what is required to set up a development environment for VB on a stand-alone Windows 98/NT computer, Windows computers that include Networking, an e3000 Networked and,  finally, an e3000 on which ODBC is enabled for networked database access. 

Stand-Alone Windows with VB 

Now consider what is required to set up a development environment for VB on a stand-alone Windows 98/NT computer.  Let’s say that you already own the Windows 98/NT computer and you want to start developing in VB for the first time.  Here are the typical steps to start developing in VB: 

  1. Purchase VB.
  2. Ensure that you have Internet Explorer 5 or higher.
  3. Ensure that you have the latest version of Windows Installer.
  4. Upgrade 98/NT to the minimum required service pack for VB.
  5. Upgrade the Microsoft Data Access Components to the minimum level required by Visual Basic.
  6. Install Visual Basic
  7. Install the latest Visual Basic service pack.

Visual Data Manager 

The Visual Data Manager is an often overlooked software product that Microsoft gives away!  It can be used either stand-alone or as a VB add-in.  An example of it’s use as a VB add-in will be shown later in this article. 

  1. Download the Visual Data Manager
  2. Install the software after VB has been installed

Windows Networking

Now consider a two computer environment in a least two computers are networked.    Let’s say that you already own the Windows 98/NT computers and you want to start networking for the first time.  Here are the typical steps to networking:

 

  1. Install LAN adapters in each computer.
  2. Connect each computer by cable to a Hub.
  3. Make sure that you have your Windows 98/NT installation and Service Pack CD’s handy.
  4. Using Settings/Control Panel,  configure the computer for TCP/IP networking.
  5. When the system tells you to do it insert the Windows 98/NT CD in its drive.
  6. Reboot the systems.
  7. Reapply the Service Pack.
  8. Test your networking connection.

e3000 Networking

Next, the e3000 must be configured for networking.  Here are the typical steps to e3000 networking: 

  1. Make sure the jumpers are set correctly for the LAN adapter.  (All supported models come with the built-in LAN hardware.)
  2. Connect each computer by cable to a Hub that the Windows computers are attached to.
  3. Using NMMGR configure the e3000 to have an IP address in the same range as the Windows computers.
  4. Test your networking connection.

e3000 ODBC Access

Finally, after e3000 networking has been enabled, the e3000 must be configured for ODBC access to databases.  Here are the typical steps to ODBC configuration: 

  1. Add a DBE to an existing IMAGE database.
  2. Start the ODBC listener process.
  3. Download the ODBC/SE client software from the e3000 to the Windows computer.
  4. Install ODBC the driver software on the Windows computer.
  5. Configure a DSN for the ODBC data source.
  6.  Test your ODBC configuration

Properly Configured 

Once Visual Basic has been installed, the Windows computers and the e3000 have been setup for networking, the database has been configured and the ODBC software has been configured, the development environment can be considered to be properly configured

Getting something to work...

 This article presents a trivial example of Visual Basic/e3000 integration.  It will show that it is after configuration issues are resolved, use  of the e3000 with Visual Basic is in most cases no more difficult than using Visual Basic with a native 98/NT data source or application.  When both the client host and the server host are properly configured for networking and interoperability (using the right middleware products), it is often difficult to tell which server is actually being used!  

How Easy Is It?

 Using an “off-the-shelf” e3000 and an “off-the-shelf” Windows 98/NT computer with Visual Basic 6.0 and some free software, it is possible to create a simple client/server application for any database in just a few minutes.  The caveat is that both the e3000 and the Windows platforms must be properly configured, we’ll get back to that.  The point here is that the application can be created without purchasing any software other than what comes with the base e3000 which must include a database product (IMAGE or ALLBASE) and any Intel based client or server host (pc or server) with Visual Basic 6.0 or higher, it is possible to create a client/server application. 

An Example

 Figure 1 shows a screen that can be used to maintain one table of the MUSIC database that comes with all e3000’s.   Figure 2 shows the Visual Basic code that the application contains.  This application was created in less than two minutes and without my writing a single line of code!

 

  Figure 1.1

 

Assuming that the e3000 and the Windows computer have been properly configured,   (Where proper configuration includes network configuration, and installation and configuration of certain optional features and Windows/MPE integration.), these are the steps required to create the above application. 

  1. Create an ODBC Datasource for the MUSIC database.
  2. Launch Visual Basic
  3. Open an Standard exe project
  4. Remove the generated form.
  5. Select Add-Ins Visual Data Manager
  6. File > Open Database > ODBC
  7. DSN “MUSICDBE”
  8. OK
  9. Select the Album table
  10. Utility > Data Form Designer
  11. Choose a form name, I used Album
  12. From the RecordSoruce drop down list choose Album
  13. Select whichever fields you want to use.  I just choose them all (>>).
  14. Press the “Build the Form” button.
  15. Exit the Visual Data Manager.
  16. On the Visual Basic Panel, select Project > Properties
  17. Change the Startup Object (dropdown list) to the name of your form.
  18. Close the dialog box by pressing “Ok”.
  19. Press Run > Start With Full Compile.

A Small Matter of Proper Configuration

 All e3000’s come with scripts to create at least two sample databases.  These are in the SAMPLEDB group of the SYS account.  One of these databases is called MUSIC.   The scripts not only create the database but also create a DBE to allow SQL access.  Configuring the e3000 for our example includes creating the MUSIC database and its DBE.  One must also network enable the e3000 by configuring in a proper IP address.  

The Windows computer must also be network enabled and Visual Basic with the proper level of Microsoft Data Access components must be installed.  This computer too must be assigned an appropriate IP address.   Finally, both computers must be networked together using cables, hubs, etc.

 

Private Sub cmdAdd_Click()
 
Data1.Recordset.AddNew
End Sub

Private Sub cmdDelete_Click()
 
'this may produce an error if you delete the last
 
'record or the only record in the recordset  Data1.Recordset.Delete
 
Data1.Recordset.MoveNext
End Sub

Private Sub cmdRefresh_Click()
  'this is really only needed for multi user apps
 
Data1.Refresh
End Sub

Private Sub cmdUpdate_Click()
 
Data1.UpdateRecord
 
Data1.Recordset.Bookmark = Data1.Recordset.LastModified
End Sub

Private Sub cmdClose_Click()
 
Unload Me
End Sub

Private Sub Data1_Error(DataErr As Integer, Response As Integer)

  'This is where you would put error handling code
 
'If you want to ignore errors, comment out the next line
 
'If you want to trap them, add code here to handle them
 
MsgBox "Data error event hit err:" & Error$(DataErr)
 
Response = 0  'throw away the error
End Sub

Private Sub Data1_Reposition()
 
Screen.MousePointer = vbDefault
 
On Error Resume Next
 
'This will display the current record position
 
'for dynasets and snapshots
 
Data1.Caption = "Record: " & (Data1.Recordset.AbsolutePosition + 1)
 
'for the table object you must set the index property when
 
'the recordset gets created and use the following line
 
'Data1.Caption = "Record: " & (Data1.Recordset.RecordCount * (Data1.Recordset.PercentPosition * 0.01)) + 1
End Sub

Private Sub Data1_Validate(Action As Integer, Save As Integer)
 
'This is where you put validation code
 
'This event gets called when the following actions occur

  Select Case Action
   
Case vbDataActionMoveFirst
   
Case vbDataActionMovePrevious
   
Case vbDataActionMoveNext
   
Case vbDataActionMoveLast
   
Case vbDataActionAddNew
   
Case vbDataActionUpdate
   
Case vbDataActionDelete
   
Case vbDataActionFind
    
Case vbDataActionBookmark
   
Case vbDataActionClose
 
End Select
 
Screen.MousePointer = vbHourglass
End Sub

.

download.gif (899 bytes) Download the source


Copyright (c) 1999 - 2000 Transformix Computer Corporation
Comments and suggestions to the Webmaster.