home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form DlgImportDB
- BorderStyle = 3 'Fixed Dialog
- Caption = "Import from database"
- ClientHeight = 3495
- ClientLeft = 2760
- ClientTop = 3750
- ClientWidth = 6030
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 3495
- ScaleWidth = 6030
- ShowInTaskbar = 0 'False
- Begin VB.CommandButton Command1
- Caption = "Get tables"
- Height = 255
- Left = 120
- TabIndex = 13
- Top = 3120
- Width = 1215
- End
- Begin VB.TextBox TxtSelect
- Height = 495
- Left = 2640
- TabIndex = 12
- Text = "SELECT * FROM []"
- Top = 2040
- Width = 3255
- End
- Begin VB.ListBox ListTables
- Height = 1035
- Left = 120
- TabIndex = 9
- Top = 2040
- Width = 2295
- End
- Begin VB.Frame Frame1
- Caption = "Source"
- Height = 1575
- Left = 120
- TabIndex = 2
- Top = 120
- Width = 3855
- Begin VB.CommandButton BtnBuild
- Caption = "Build"
- Height = 255
- Left = 2880
- TabIndex = 8
- Top = 1080
- Width = 855
- End
- Begin VB.CommandButton BtnBrowse
- Caption = "Browse"
- Height = 255
- Left = 2880
- TabIndex = 7
- Top = 480
- Width = 855
- End
- Begin VB.TextBox TxtADO
- Height = 285
- Left = 480
- TabIndex = 6
- Top = 1080
- Width = 2295
- End
- Begin VB.TextBox TxtFile
- Height = 285
- Left = 480
- TabIndex = 5
- Top = 480
- Width = 2295
- End
- Begin VB.OptionButton OptADO
- Caption = "from ADO connection string"
- Height = 255
- Left = 240
- TabIndex = 4
- Top = 840
- Width = 2655
- End
- Begin VB.OptionButton OptAccessFile
- Caption = "from MSAccess file"
- Height = 255
- Left = 240
- TabIndex = 3
- Top = 240
- Width = 2535
- End
- End
- Begin VB.CommandButton CancelButton
- Caption = "Cancel"
- Height = 375
- Left = 4680
- TabIndex = 1
- Top = 600
- Width = 1215
- End
- Begin VB.CommandButton OKButton
- Caption = "Import"
- Height = 375
- Left = 4680
- TabIndex = 0
- Top = 120
- Width = 1215
- End
- Begin VB.Label Label2
- Caption = "Query statement"
- Height = 255
- Left = 2640
- TabIndex = 11
- Top = 1800
- Width = 2055
- End
- Begin VB.Label Label1
- Caption = "Tables in database"
- Height = 255
- Left = 120
- TabIndex = 10
- Top = 1800
- Width = 2295
- End
- Attribute VB_Name = "DlgImportDB"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Public bOK As Boolean
- Option Explicit
- Private Sub BtnBrowse_Click()
- Dim objDlg
- Set objDlg = CreateObject("MSComDlg.CommonDialog")
- objDlg.ShowOpen
- If Len(objDlg.FileName) > 0 Then
- TxtFile.Text = objDlg.FileName
- End If
- End Sub
- Private Sub BtnBuild_Click()
- Dim objADO As DataLinks
- Set objADO = CreateObject("DataLinks")
- If Not (objADO Is Nothing) Then
- Dim objConn As Connection
- Set objConn = objADO.PromptNew
- TxtADO.Text = objConn.ConnectionString
- End If
- End Sub
- Private Sub CancelButton_Click()
- Hide
- End Sub
- Private Sub Command1_Click()
- Dim objImpSettings As XMLSpyDatabaseConnection
- Set objImpSettings = objSpy.GetDatabaseSettings
- If OptAccessFile.Value = True Then
- objImpSettings.File = TxtFile.Text
- Else
- objImpSettings.ADOConnection = TxtADO.Text
- End If
- ListTables.Clear
- Dim objList As XMLSpyElementList
- Dim objItem As XMLSpyElementListItem
- On Error GoTo ErrorHandler
- Set objList = objSpy.GetDatabaseTables(objImpSettings)
- For Each objItem In objList
- ListTables.AddItem objItem.Name
- Next
- Exit Sub
- ErrorHandler:
- CheckForError
- End Sub
- Private Sub Form_Activate()
- OptAccessFile.Value = True
- UpdateSourceGrp
- bOK = False
- End Sub
- Private Sub OKButton_Click()
- bOK = True
- Hide
- End Sub
- Private Sub OptADO_Click()
- UpdateSourceGrp
- End Sub
- Private Sub OptAccessFile_Click()
- UpdateSourceGrp
- End Sub
- Private Sub UpdateSourceGrp()
- TxtFile.Enabled = False
- BtnBrowse.Enabled = False
- TxtADO.Enabled = False
- BtnBuild.Enabled = False
- If OptAccessFile.Value = True Then
- TxtFile.Enabled = True
- BtnBrowse.Enabled = True
- Else
- TxtADO.Enabled = True
- BtnBuild.Enabled = True
- End If
- End Sub
-