home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / source / chap29 / frm129.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-07-11  |  4.9 KB  |  147 lines

  1. VERSION 4.00
  2. Begin VB.Form form1 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   6030
  5.    ClientLeft      =   1095
  6.    ClientTop       =   1515
  7.    ClientWidth     =   6720
  8.    Height          =   6435
  9.    Left            =   1035
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   6030
  12.    ScaleWidth      =   6720
  13.    Top             =   1170
  14.    Width           =   6840
  15.    Begin VB.CommandButton cmdcache 
  16.       Caption         =   "&Cache"
  17.       Height          =   495
  18.       Left            =   1560
  19.       TabIndex        =   5
  20.       Top             =   4560
  21.       Width           =   1215
  22.    End
  23.    Begin VB.CommandButton cmdlogmessages 
  24.       Caption         =   "&Log Messages"
  25.       Height          =   495
  26.       Left            =   120
  27.       TabIndex        =   4
  28.       Top             =   4560
  29.       Width           =   1215
  30.    End
  31.    Begin VB.CommandButton cmdexequtesql 
  32.       Caption         =   "&Execute SQL"
  33.       Height          =   495
  34.       Left            =   4560
  35.       TabIndex        =   3
  36.       Top             =   5280
  37.       Width           =   1275
  38.    End
  39.    Begin VB.CommandButton cmdcreaterecordset 
  40.       Caption         =   "&Create Recordset"
  41.       Height          =   495
  42.       Left            =   3060
  43.       TabIndex        =   2
  44.       Top             =   5280
  45.       Width           =   1275
  46.    End
  47.    Begin VB.CommandButton cmdregister 
  48.       Caption         =   "&Register DataBase"
  49.       Height          =   495
  50.       Left            =   1560
  51.       TabIndex        =   1
  52.       Top             =   5280
  53.       Width           =   1275
  54.    End
  55.    Begin VB.CommandButton cmdopenodbc 
  56.       Caption         =   "&Open ODBC"
  57.       Height          =   495
  58.       Left            =   120
  59.       TabIndex        =   0
  60.       Top             =   5280
  61.       Width           =   1215
  62.    End
  63. Attribute VB_Name = "form1"
  64. Attribute VB_Creatable = False
  65. Attribute VB_Exposed = False
  66. Option Explicit
  67. Private Sub cmdcache_Click()
  68. Dim db As Database
  69. Dim ws As Workspace
  70. Dim sconnect As String
  71. Dim rs As Recordset
  72. Set ws = DBEngine.CreateWorkspace("ws1", "ADMIN", "")
  73. ' Now open the DataBase
  74. Set db = ws.OpenDatabase("BIBLIO", False, False, "ODBC;" & sconnect)
  75. Set rs = db.OpenRecordset("select * from titles", dbOpenDynaset, dbSQLPassThrough)
  76. rs.CacheSize = 25
  77. rs.CacheStart = rs.Bookmark
  78. rs.FillCache rs.CacheSize, rs.CacheStart
  79. End Sub
  80. Private Sub cmdcreaterecordset_Click()
  81. Dim db As Database
  82. Dim ws As Workspace
  83. Dim sconnect As String
  84. Dim rs As Recordset
  85. ' Now open the DataBase
  86. Set ws = DBEngine.CreateWorkspace("ws1", "ADMIN", "")
  87. sconnect = "DataBase= BIBLIO,UID=ADMIN,PWD=Admin"
  88. Set db = ws.OpenDatabase("BIBLIO", False, False, "ODBC;" & sconnect)
  89. Set rs = db.OpenRecordset("select * from titles", dbOpenDynaset, dbSQLPassThrough)
  90. End Sub
  91. Private Sub cmdexequtesql_Click()
  92. Dim db As Database
  93. Dim ws As Workspace
  94. Dim sconnect As String
  95. Dim rs As Recordset
  96. Dim nrows As Long
  97. Dim csql As String
  98. ' Now open the DataBase
  99. Set ws = DBEngine.CreateWorkspace("ws1", "ADMIN", "")
  100. sconnect = "DataBase= BIBLIO,UID=ADMIN,PWD=Admin"
  101. Set db = ws.OpenDatabase("BIBLIO", False, False, "ODBC;" & sconnect)
  102. Set rs = db.OpenRecordset("select * from titles", dbOpenDynaset, dbSQLPassThrough)
  103. csql = " update titles set notes = 'Test Notes' "
  104. nrows = db.ExecuteSQL(csql)
  105. End Sub
  106. Private Sub cmdlogmessages_Click()
  107. Dim ws As Workspace
  108. Dim db As Database
  109. Dim qrynew As QueryDef
  110. Dim rstitles As Recordset
  111. Dim propmessages As Property
  112. Dim sconnect As String
  113. Set ws = DBEngine.CreateWorkspace("title", "Admin", "")
  114. Set db = ws.OpenDatabase("BIBLIO", False, False, "ODBC;" & sconnect)
  115. ' Create a New QueryDef
  116. Set qrynew = db.CreateQueryDef("new", "Select * from titles where pubid = 13")
  117. ' Set the connect information for the Query
  118. sconnect = "DataBase= BIBLIO,UID=ADMIN,PWD=Admin"
  119. qrynew.Connect = sconnect
  120. ' Load The Recordset based on the New Query
  121. Set rstitles = db.OpenRecordset("new", dbOpenDynaset)
  122. Set propmessages = qrynew.CreateProperty("logmessages", dbBoolean, True, False)
  123. ' Save the Property definition
  124. qrynew.Properties.Append propmessages
  125. ' Set the Query to Log messages
  126. qrynew.logmessages = True
  127. End Sub
  128. Private Sub cmdopenodbc_Click()
  129. Dim db As Database
  130. Dim ws As Workspace
  131. Dim sconnect As String
  132. Set ws = DBEngine.CreateWorkspace("ws1", "ADMIN", "")
  133. sconnect = "DataBase=BIBLIO;UID=ADMIN;PWD="
  134. Set db = ws.OpenDatabase("BIBLIO", False, False, "ODBC;" & sconnect)
  135. End Sub
  136. Private Sub cmdregister_Click()
  137. Dim db As Database
  138. Dim ws As Workspace
  139. Dim sconnect As String
  140. sconnect = "network1"
  141. DBEngine.RegisterDatabase "BIBLIO", "ORACLES", True, sconnect
  142. ' Now open the DataBase
  143. Set ws = DBEngine.CreateWorkspace("ws1", "ADMIN", "")
  144. sconnect = "DataBase= BIBLIO,UID=ADMIN,PWD=Admin"
  145. Set db = ws.OpenDatabase("BIBLIO", False, False, "ODBC;" & sconnect)
  146. End Sub
  147.