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

📄 02.txt

📁 仍然是SQL语言学习版 可以致用的一些文章
💻 TXT
字号:
Begin VB.Form FrmDTSPackage 
   Caption         =   "DTS Sample"
   ClientHeight    =   5052
   ClientLeft      =   60
   ClientTop       =   348
   ClientWidth     =   5676
   LinkTopic       =   "FrmDTSPackage"
   ScaleHeight     =   5052
   ScaleWidth      =   5676
   StartUpPosition =   2  'CenterScreen
   Begin VB.TextBox TxtPackPwd 
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   14.4
         Charset         =   136
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty

      Height          =   375
      Left            =   2520
      TabIndex        =   12
      Top             =   3360
      Width           =   2775
   End
   Begin VB.TextBox TxtPackage 
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   14.4
         Charset         =   136
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   2520
      TabIndex        =   11
      Top             =   2880
      Width           =   2775
   End
   Begin VB.TextBox TxtPassword 
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   14.4
         Charset         =   136
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   2520
      TabIndex        =   10
      Top             =   2400
      Width           =   2775
   End
   Begin VB.TextBox TxtUsrName 
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   14.4

         Charset         =   136
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   2520
      TabIndex        =   9
      Top             =   1920
      Width           =   2775
   End
   Begin VB.TextBox TxtSvrName 
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   14.4
         Charset         =   136
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   2520
      TabIndex        =   8
      Top             =   1440
      Width           =   2775
   End
   Begin VB.CommandButton CmdExit 
      Caption         =   "取消"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   13.8
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   3000
      TabIndex        =   7

      Top             =   4080
      Width           =   2055
   End
   Begin VB.CommandButton CmdExecute 
      Caption         =   "执行"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   13.8
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   480
      TabIndex        =   0
      Top             =   4080
      Width           =   2295
   End
   Begin VB.Label LblProperty 
      BackColor       =   &H00FFFFFF&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "包的密码"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   13.8
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   4
      Left            =   0
      TabIndex        =   6
      Top             =   3360
      Width           =   2445
   End
   Begin VB.Label LblProperty 
      BackColor       =   &H00FFFFFF&

      BorderStyle     =   1  'Fixed Single
      Caption         =   "包的名称"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   13.8
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   3
      Left            =   0
      TabIndex        =   5
      Top             =   2880
      Width           =   2445
   End
   Begin VB.Label LblProperty 
      BackColor       =   &H00FFFFFF&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "密码"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   13.8
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   2
      Left            =   0
      TabIndex        =   4
      Top             =   2400
      Width           =   2445
   End
   Begin VB.Label LblProperty 
      BackColor       =   &H00FFFFFF&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "用户名称"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   13.8
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   1
      Left            =   0
      TabIndex        =   3
      Top             =   1920
      Width           =   2445
   End
   Begin VB.Label LblProperty 
      BackColor       =   &H00FFFFFF&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "服务器名称"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   13.8
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   0
      Left            =   0
      TabIndex        =   2
      Top             =   1440
      Width           =   2445
   End
   Begin VB.Label LblTitle 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "这是一个 DTS包的示例,通过DTS包对象来执行远程SQL Server中的包。"
      BeginProperty Font 
         Name            =   "宋体"

         Size            =   13.8
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   975
      Left            =   0
      TabIndex        =   1
      Top             =   240
      Width           =   5175
   End
End
Attribute VB_Name = "FrmDTSPackage"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub CmdExecute_Click() '执行包
    Dim MyPackage As DTS.Package
    
    On Error GoTo ErrMsg
    '**********判断包的数据是否为空值
    If TxtSvrName.Text = "" Then
        MsgBox "服务器名称不可为空值!", vbCritical, "错误"
        Exit Sub
    End If
    If TxtUsrName.Text = "" Then
        MsgBox "用户名称不可为空值!", vbCritical, "错误"
        Exit Sub
    End If
    If TxtPackage.Text = "" Then
        MsgBox "包的名称不可为空白!", vbCritical, "错误"
        Exit Sub
    End If
    
    '**********创建新的包对象
    Set MyPackage = New DTS.Package
    
    '*************读取要执行的包,并执行。
    With MyPackage

        .LoadFromSQLServer TxtSvrName.Text, TxtUsrName.Text, TxtPassword.Text, DTSSQLStgFlag_Default, TxtPackPwd.Text, , , TxtPackage.Text
        .Execute
    End With
    MsgBox "数据已经转换完成!", vbOKOnly + vbInformation, "消息"
    Set MyPackage = Nothing
    Exit Sub
ErrMsg:
    MsgBox "转换数据时发生错误!" & Chr(13) & "错误代码: " & Err.Number & Chr(13) & "错误消息: " & Err.Description, vbCritical, "错误"
    Exit Sub
End Sub

Private Sub CmdExit_Click()
    Unload Me
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
   Dim EMsg As String
    
   EMsg = MsgBox("是否确定取消?", vbOKCance + vbQuestion, "取消")
   If EMsg = vbCancel Then
        Cancel = True
    End If
End Sub

Private Sub Form_Terminate()
    Set FrmDTSPackage = Nothing
End Sub

⌨️ 快捷键说明

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