form1.frm

来自「vb源码大全」· FRM 代码 · 共 45 行

FRM
45
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   1680
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6165
   LinkTopic       =   "Form1"
   ScaleHeight     =   1680
   ScaleWidth      =   6165
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "连接Oracle数据库"
      Height          =   495
      Left            =   1320
      TabIndex        =   0
      Top             =   480
      Width           =   2775
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False


Private Sub Command2_Click()
    Dim Cnn As New ADODB.Connection
    Dim Rst As New ADODB.Recordset
        'Connect to the Database
    Cnn.CursorLocation = adUseClient 'Can bypass
    Cnn.Open "oracle_test", "hyx", "hyx123"     'oracle_test为ODBC的DSN名
    Debug.Print Cnn.state                       '1为连上
    'Rst.CursorType = adOpenKeyset
    Rst.CursorType = adOpenStatic
    Rst.LockType = adLockOptimistic
    Rst.CursorLocation = adUseClient
     Rst.Open "tabpic3", Cnn, , , adCmdTable        'tabpic3为表名
    Debug.Print Rst.state                       '1为opened
    '...
End Sub


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?