⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmmain.frm

📁 《VB6数据库开发指南》所有的例程的源码
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmMain 
   Caption         =   "Authors"
   ClientHeight    =   3420
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5415
   LinkTopic       =   "Form1"
   ScaleHeight     =   3420
   ScaleWidth      =   5415
   StartUpPosition =   3  'Windows Default
   Begin VB.CheckBox chkContract 
      Caption         =   "Contract"
      DataField       =   "contract"
      DataSource      =   "adodc"
      Height          =   375
      Left            =   2760
      TabIndex        =   14
      Top             =   2520
      Width           =   1935
   End
   Begin VB.TextBox txtPhone 
      DataField       =   "phone"
      DataSource      =   "adodc"
      Height          =   375
      Left            =   120
      TabIndex        =   12
      Top             =   2520
      Width           =   2535
   End
   Begin VB.TextBox txtZip 
      DataField       =   "zip"
      DataSource      =   "adodc"
      Height          =   375
      Left            =   3720
      TabIndex        =   5
      Top             =   1800
      Width           =   1575
   End
   Begin VB.TextBox txtState 
      DataField       =   "state"
      DataSource      =   "adodc"
      Height          =   375
      Left            =   2760
      TabIndex        =   4
      Top             =   1800
      Width           =   855
   End
   Begin VB.TextBox txtCity 
      DataField       =   "city"
      DataSource      =   "adodc"
      Height          =   375
      Left            =   120
      TabIndex        =   3
      Top             =   1800
      Width           =   2535
   End
   Begin VB.TextBox txtAddress 
      DataField       =   "address"
      DataSource      =   "adodc"
      Height          =   375
      Left            =   120
      TabIndex        =   2
      Top             =   1080
      Width           =   5175
   End
   Begin VB.TextBox txtLastName 
      DataField       =   "au_lname"
      DataSource      =   "adodc"
      Height          =   375
      Left            =   2760
      TabIndex        =   1
      Top             =   360
      Width           =   2535
   End
   Begin VB.TextBox txtFirstName 
      DataField       =   "au_fname"
      DataSource      =   "adodc"
      Height          =   375
      Left            =   120
      TabIndex        =   0
      Top             =   360
      Width           =   2535
   End
   Begin MSAdodcLib.Adodc adodc 
      Align           =   2  'Align Bottom
      Height          =   390
      Left            =   0
      Top             =   3030
      Width           =   5415
      _ExtentX        =   9551
      _ExtentY        =   688
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   2
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "Authors"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.Label lblPhone 
      Caption         =   "Phone"
      Height          =   375
      Left            =   120
      TabIndex        =   13
      Top             =   2280
      Width           =   1095
   End
   Begin VB.Label lblZip 
      Caption         =   "Zip Code"
      Height          =   375
      Left            =   3720
      TabIndex        =   11
      Top             =   1560
      Width           =   1575
   End
   Begin VB.Label lblState 
      Caption         =   "State"
      Height          =   255
      Left            =   2760
      TabIndex        =   10
      Top             =   1560
      Width           =   855
   End
   Begin VB.Label lblCity 
      Caption         =   "City"
      Height          =   375
      Left            =   120
      TabIndex        =   9
      Top             =   1560
      Width           =   1695
   End
   Begin VB.Label lblAddress 
      Caption         =   "Address"
      Height          =   255
      Left            =   120
      TabIndex        =   8
      Top             =   840
      Width           =   2175
   End
   Begin VB.Label lblLastName 
      Caption         =   "Last"
      Height          =   375
      Left            =   2760
      TabIndex        =   7
      Top             =   120
      Width           =   1335
   End
   Begin VB.Label lblFirstName 
      Caption         =   "First"
      Height          =   375
      Left            =   120
      TabIndex        =   6
      Top             =   120
      Width           =   1935
   End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Form_Load()
    Dim conn As Connection
    Dim rs As Recordset
    
    'open the connection
    Set conn = New Connection
    conn.Open "Provider=MS Remote;Remote Server=http://winemiller" _
        + ";Remote Provider=MSDASQL;DSN=pubs"
    
    'fill the list
    Set rs = New Recordset
    rs.CursorLocation = adUseClient
    rs.Open "authors", conn, adOpenStatic _
        , adLockBatchOptimistic, adCmdTable
        
    Set adodc.Recordset = rs
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Dim rs As Recordset
    Dim conn As Connection
    
    'open the connection
    Set conn = New Connection
    Set rs = New Recordset
    
    On Error GoTo UpdateFailure
    conn.Open "Provider=MS Remote;Remote Server=http://winemiller" _
        + ";Remote Provider=MSDASQL;DSN=pubs"
        
    rs.Open adodc.Recordset, conn
    rs.UpdateBatch
    On Error GoTo 0
UpdateDone:
    Exit Sub
UpdateFailure:
    ShowADOError conn
    GoTo UpdateDone
End Sub


Private Sub ShowADOError(pConn As Connection)
    'spin through the errors collection and
    'display the constructed error message
    Dim ADOError As Error
    Dim sError As String
    For Each ADOError In pConn.Errors
        sError = sError & ADOError.Number & " - " & ADOError.Description _
            + vbCrLf
    Next ADOError
    MsgBox sError
End Sub


⌨️ 快捷键说明

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