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

📄 import.ctl

📁 这是一个可以实现从数据库外部直接转入任何表的任何数据的控件的源代码
💻 CTL
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.UserControl ImPort 
   BackStyle       =   0  '透明
   ClientHeight    =   5400
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   7545
   ScaleHeight     =   5400
   ScaleWidth      =   7545
   ToolboxBitmap   =   "ImPort.ctx":0000
   Begin VB.Frame Frame2 
      Caption         =   "选择字段匹配"
      Height          =   3345
      Left            =   30
      TabIndex        =   10
      Top             =   1470
      Width           =   7425
      Begin MSComctlLib.ListView lis_ImYbzd 
         Height          =   2565
         Left            =   120
         TabIndex        =   11
         Top             =   270
         Width           =   2385
         _ExtentX        =   4207
         _ExtentY        =   4524
         View            =   3
         LabelEdit       =   1
         LabelWrap       =   -1  'True
         HideSelection   =   0   'False
         FullRowSelect   =   -1  'True
         _Version        =   393217
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         BorderStyle     =   1
         Appearance      =   1
         NumItems        =   1
         BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
            Text            =   "目标表字段"
            Object.Width           =   2469
         EndProperty
      End
      Begin MSComctlLib.ProgressBar PBar 
         Height          =   255
         Left            =   120
         TabIndex        =   12
         Top             =   2940
         Width           =   7155
         _ExtentX        =   12621
         _ExtentY        =   450
         _Version        =   393216
         Appearance      =   1
         Scrolling       =   1
      End
      Begin MSComctlLib.ListView Lis_ImMbbzd 
         Height          =   2565
         Left            =   2520
         TabIndex        =   13
         Top             =   270
         Width           =   2445
         _ExtentX        =   4313
         _ExtentY        =   4524
         View            =   3
         LabelEdit       =   1
         LabelWrap       =   -1  'True
         HideSelection   =   0   'False
         FullRowSelect   =   -1  'True
         _Version        =   393217
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         BorderStyle     =   1
         Appearance      =   1
         NumItems        =   1
         BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
            Text            =   "源表字段"
            Object.Width           =   5292
         EndProperty
      End
      Begin MSComctlLib.ListView Lis_ImZdpp 
         Height          =   2565
         Left            =   4980
         TabIndex        =   14
         Top             =   270
         Width           =   2295
         _ExtentX        =   4048
         _ExtentY        =   4524
         View            =   3
         LabelEdit       =   1
         LabelWrap       =   -1  'True
         HideSelection   =   0   'False
         Checkboxes      =   -1  'True
         FullRowSelect   =   -1  'True
         _Version        =   393217
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         BorderStyle     =   1
         Appearance      =   1
         NumItems        =   2
         BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
            Text            =   "源表字段"
            Object.Width           =   2469
         EndProperty
         BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
            SubItemIndex    =   1
            Text            =   "目标表字段"
            Object.Width           =   2540
         EndProperty
      End
   End
   Begin VB.CommandButton cmd_ImDr 
      Caption         =   "导入"
      Height          =   405
      Left            =   5010
      TabIndex        =   9
      Top             =   4860
      Width           =   1185
   End
   Begin VB.CommandButton cmd_ImQuit 
      Caption         =   "关闭"
      Height          =   405
      Left            =   6240
      TabIndex        =   8
      Top             =   4860
      Width           =   1185
   End
   Begin VB.Frame Frame1 
      Height          =   1365
      Left            =   30
      TabIndex        =   3
      Top             =   60
      Width           =   7425
      Begin VB.OptionButton OptIn 
         Caption         =   "导入内部表"
         Height          =   195
         Left            =   2880
         TabIndex        =   17
         Top             =   240
         Width           =   1335
      End
      Begin VB.OptionButton OptOut 
         Caption         =   "导入外部表"
         Height          =   315
         Left            =   1230
         TabIndex        =   16
         Top             =   180
         Value           =   -1  'True
         Width           =   1305
      End
      Begin VB.ComboBox txt_ImMbbm 
         Height          =   300
         Left            =   1260
         Style           =   2  'Dropdown List
         TabIndex        =   15
         Top             =   930
         Width           =   5235
      End
      Begin VB.CommandButton cmd_Ybm 
         Caption         =   ">>"
         Height          =   315
         Left            =   6510
         TabIndex        =   5
         Top             =   930
         Width           =   825
      End
      Begin VB.TextBox txt_ImYbm 
         Height          =   300
         Left            =   1260
         TabIndex        =   4
         Top             =   600
         Width           =   6045
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "导入目标表名"
         Height          =   180
         Left            =   120
         TabIndex        =   7
         Top             =   660
         Width           =   1080
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "导入源表名"
         Height          =   180
         Left            =   300
         TabIndex        =   6
         Top             =   960
         Width           =   975
      End
   End
   Begin VB.CommandButton cmdAotu 
      Caption         =   "自动匹配"
      Height          =   405
      Left            =   3870
      TabIndex        =   2
      Top             =   4860
      Width           =   1095
   End
   Begin VB.CommandButton cmdRep 
      Caption         =   "参照替换"
      Height          =   405
      Left            =   1350
      TabIndex        =   1
      Top             =   4860
      Width           =   1215
   End
   Begin VB.CommandButton cmdRef 
      Caption         =   "字段重置"
      Height          =   405
      Left            =   2610
      TabIndex        =   0
      Top             =   4860
      Width           =   1215
   End
   Begin MSComDlg.CommonDialog Cd 
      Left            =   1440
      Top             =   510
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
End
Attribute VB_Name = "ImPort"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Public Enum Im_AreaType
    ToOutDatabase = 1
    ToInDatabase = 2
    ToBothDatabase = 3
End Enum
Public Enum DB_Type
    ToAccess = 1
    ToSqlserver = 2
End Enum
Public Im_DBType As DB_Type
Dim Im_Connection As New Connection
Dim Im_TbStr As String
Dim S_Mb As New Recordset
Dim S_Yb As New Recordset
Dim Im_Conn As New Connection
Public Event EndClick()

Private Sub cmd_ImDr_Click()
    On Error GoTo sk
    Dim SS_i
    Dim SS_Yn
    Dim SS_Mb, SS_Yb
    Dim SS_Col
    Dim SS_Check As Boolean
    Dim SS_TB As New Recordset
    SS_Yn = MsgBox("您正准备导入数据,如果要清空库中原数据后再添加,请选择“是”,如果只对库进行追加而不清空,请选择“否”。", 3 + 16)
    If SS_Yn = 6 Then
        Im_Connection.Execute "delete from " & txt_ImYbm.Text
    ElseIf SS_Yn = 2 Then
        Exit Sub
    End If
    SS_Yn = MsgBox("是否进行冲突检测?", 3 + 16)
    SS_Check = False
    If SS_Yn = 6 Then
        SS_Check = True
    ElseIf SS_Yn = 2 Then
        Exit Sub
    End If
    If S_Mb.State = 1 Then Set S_Mb = Nothing
    S_Mb.Open "select top 0 * from (" & Im_TbStr & ") as tem", Im_Connection, adOpenDynamic, adLockOptimistic
    PBar.Max = S_Yb.RecordCount + 1
    PBar.Value = 0
    SS_Col = 0
    If Not S_Yb.EOF Or Not S_Yb.BOF Then
        S_Yb.MoveFirst
    End If
    While Not S_Yb.EOF
        PBar.Value = PBar.Value + 1
        If SS_Check = True Then
            SS_Yb = ""
            For SS_i = 1 To Lis_ImZdpp.ListItems.Count
                If Lis_ImZdpp.ListItems(SS_i).Checked = True Then
                    SS_Mb = Lis_ImZdpp.ListItems(SS_i).Text
                    SS_Yb = SS_Yb & " and " & Lis_ImZdpp.ListItems(SS_i).SubItems(1) & "='" & S_Yb(SS_Mb) & "'"
                End If
            Next SS_i
            If SS_Yb <> "" Then
                SS_Yb = Mid(SS_Yb, 5)
            Else

⌨️ 快捷键说明

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