home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / rds.cab / vbtovb.dob < prev    next >
Text File  |  1997-08-14  |  6KB  |  195 lines

  1. VERSION 5.00
  2. Begin VB.UserDocument VbtoVBdoc 
  3.    ClientHeight    =   4050
  4.    ClientLeft      =   165
  5.    ClientTop       =   735
  6.    ClientWidth     =   9165
  7.    HScrollSmallChange=   15
  8.    ScaleHeight     =   4050
  9.    ScaleWidth      =   9165
  10.    VScrollSmallChange=   15
  11.    Begin VB.Frame Frame2 
  12.       Caption         =   "Database functions"
  13.       Height          =   2655
  14.       Left            =   240
  15.       TabIndex        =   1
  16.       Top             =   1200
  17.       Width           =   8775
  18.       Begin VB.TextBox txtServer 
  19.          Height          =   375
  20.          Left            =   3840
  21.          TabIndex        =   8
  22.          Top             =   600
  23.          Width           =   4455
  24.       End
  25.       Begin VB.ListBox List1 
  26.          Height          =   1620
  27.          Left            =   360
  28.          TabIndex        =   7
  29.          ToolTipText     =   "This list contains the results of the GetRecordset method in our Visual Basic business object"
  30.          Top             =   360
  31.          Width           =   1932
  32.       End
  33.       Begin VB.TextBox txtGetRecordset 
  34.          Height          =   372
  35.          Left            =   3840
  36.          TabIndex        =   4
  37.          Top             =   1320
  38.          Width           =   4452
  39.       End
  40.       Begin VB.TextBox txtConnect 
  41.          Height          =   372
  42.          Left            =   3840
  43.          TabIndex        =   3
  44.          Top             =   960
  45.          Width           =   4452
  46.       End
  47.       Begin VB.CommandButton cmdGetRecordset 
  48.          Caption         =   "Run"
  49.          Height          =   372
  50.          Left            =   3840
  51.          TabIndex        =   2
  52.          ToolTipText     =   "Click here to get a recordset using the SQL to the right of this button"
  53.          Top             =   1920
  54.          Width           =   1572
  55.       End
  56.       Begin VB.Label Label2 
  57.          Caption         =   "Enter valid Server, Connect, and Query properties and click Run"
  58.          Height          =   255
  59.          Left            =   3840
  60.          TabIndex        =   12
  61.          Top             =   360
  62.          Width           =   4695
  63.       End
  64.       Begin VB.Label Label5 
  65.          Caption         =   "Query:"
  66.          Height          =   255
  67.          Left            =   2640
  68.          TabIndex        =   10
  69.          ToolTipText     =   "Change this Connect string to the DSN, UID, and PWD of your database"
  70.          Top             =   1320
  71.          Width           =   855
  72.       End
  73.       Begin VB.Label Label4 
  74.          Caption         =   "Server:"
  75.          Height          =   255
  76.          Left            =   2640
  77.          TabIndex        =   9
  78.          ToolTipText     =   "Change this Connect string to the DSN, UID, and PWD of your database"
  79.          Top             =   600
  80.          Width           =   855
  81.       End
  82.       Begin VB.Label Label1 
  83.          Caption         =   "Connect:"
  84.          Height          =   255
  85.          Left            =   2640
  86.          TabIndex        =   5
  87.          ToolTipText     =   "Change this Connect string to the DSN, UID, and PWD of your database"
  88.          Top             =   960
  89.          Width           =   1095
  90.       End
  91.    End
  92.    Begin VB.Frame Frame1 
  93.       Caption         =   "Functionality Test"
  94.       Height          =   975
  95.       Left            =   240
  96.       TabIndex        =   0
  97.       Top             =   120
  98.       Width           =   8772
  99.       Begin VB.CommandButton cmdTest 
  100.          Caption         =   "Test"
  101.          Height          =   372
  102.          Left            =   240
  103.          TabIndex        =   6
  104.          ToolTipText     =   "Click here to test the functionality of the VB business object"
  105.          Top             =   360
  106.          Width           =   1572
  107.       End
  108.       Begin VB.Label Label7 
  109.          Caption         =   "Tests Minimum Functionality of Custom Business Object"
  110.          Height          =   375
  111.          Left            =   2400
  112.          TabIndex        =   11
  113.          Top             =   480
  114.          Width           =   4335
  115.       End
  116.    End
  117.    Begin VB.Menu mnuOptions 
  118.       Caption         =   "Options"
  119.       NegotiatePosition=   1  'Left
  120.       Begin VB.Menu mnuOptionsClear 
  121.          Caption         =   "Clear List box"
  122.       End
  123.       Begin VB.Menu mnuHelpAbout 
  124.          Caption         =   "About this VB Document object"
  125.       End
  126.    End
  127. End
  128. Attribute VB_Name = "VbtoVBdoc"
  129. Attribute VB_GlobalNameSpace = False
  130. Attribute VB_Creatable = True
  131. Attribute VB_PredeclaredId = False
  132. Attribute VB_Exposed = True
  133. Option Explicit
  134. Dim ads As New RDS.DataSpace
  135. Dim bo As Object  'custom business object
  136.  
  137. Private Sub UserDocument_Initialize()
  138.   On Error GoTo ehUserDocument_Initialize
  139.   txtServer.Text = "http://"
  140.   txtConnect.Text = "Dsn=AdvWorks;Uid=;Pwd=;"
  141.   txtGetRecordset.Text = "Select ProductName from Products"
  142.   Exit Sub
  143. ehUserDocument_Initialize:
  144.   MousePointer = vbNormal
  145.   MsgBox Err.Description
  146. End Sub
  147.  
  148. Private Sub cmdTest_Click()
  149.   On Error GoTo ehcmdTest_Click
  150.   MousePointer = vbHourglass
  151.   Set ads = CreateObject("RDS.DataSpace")
  152.   Set bo = ads.CreateObject("VbBusObj.VbBusObjCls", CStr(txtServer.Text))
  153.   MsgBox bo.Test
  154.   MousePointer = vbNormal
  155.   Exit Sub
  156. ehcmdTest_Click:
  157.   MousePointer = vbNormal
  158.   MsgBox Err.Description
  159. End Sub
  160.  
  161. Private Sub cmdGetRecordset_Click()
  162.   'Populates ListBox with data from Recordset
  163.   On Error GoTo ehcmdGetRecordset_Click
  164.   MousePointer = vbHourglass
  165.   Set bo = ads.CreateObject("VbBusObj.VbBusObjCls", CStr(txtServer.Text))
  166.   Dim objADORs As Object
  167.   Set objADORs = bo.GetRecordset(CStr(txtConnect.Text), CStr(txtGetRecordset.Text))
  168.   List1.Clear
  169.   While Not objADORs.EOF
  170.     List1.AddItem objADORs(0).Value
  171.     objADORs.MoveNext
  172.   Wend
  173.   MousePointer = vbNormal
  174.   Exit Sub
  175. ehcmdGetRecordset_Click:
  176.   MousePointer = vbNormal
  177.   MsgBox Err.Description
  178. End Sub
  179.  
  180. Private Sub mnuHelpAbout_Click()
  181.   Dim strApp As String, strOtherStuff As String
  182.   Dim sDataTime As String, sVersion As String
  183.   
  184.   sVersion = CStr(App.Major) & "." & CStr(App.Minor) & "." & CStr(App.Revision)
  185.   strApp = App.Title & "  v" & sVersion
  186.   strOtherStuff = "Powered By Microsoft Remote Data Service" & vbCrLf
  187.   
  188.   MsgBox strOtherStuff, vbOKOnly, strApp
  189. End Sub
  190.  
  191. Private Sub mnuOptionsClear_Click()
  192.   'this will be available under the options menu in ie4
  193.   List1.Clear
  194. End Sub
  195.