home *** CD-ROM | disk | FTP | other *** search
/ PC World 2001 January / PCWorld_2001-01_cd.bin / Software / Topware / xmlspy / xmlspy35.exe / Main / DlgImportDB.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2000-11-20  |  5.8 KB  |  199 lines

  1. VERSION 5.00
  2. Begin VB.Form DlgImportDB 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Import from database"
  5.    ClientHeight    =   3495
  6.    ClientLeft      =   2760
  7.    ClientTop       =   3750
  8.    ClientWidth     =   6030
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   3495
  13.    ScaleWidth      =   6030
  14.    ShowInTaskbar   =   0   'False
  15.    Begin VB.CommandButton Command1 
  16.       Caption         =   "Get tables"
  17.       Height          =   255
  18.       Left            =   120
  19.       TabIndex        =   13
  20.       Top             =   3120
  21.       Width           =   1215
  22.    End
  23.    Begin VB.TextBox TxtSelect 
  24.       Height          =   495
  25.       Left            =   2640
  26.       TabIndex        =   12
  27.       Text            =   "SELECT * FROM []"
  28.       Top             =   2040
  29.       Width           =   3255
  30.    End
  31.    Begin VB.ListBox ListTables 
  32.       Height          =   1035
  33.       Left            =   120
  34.       TabIndex        =   9
  35.       Top             =   2040
  36.       Width           =   2295
  37.    End
  38.    Begin VB.Frame Frame1 
  39.       Caption         =   "Source"
  40.       Height          =   1575
  41.       Left            =   120
  42.       TabIndex        =   2
  43.       Top             =   120
  44.       Width           =   3855
  45.       Begin VB.CommandButton BtnBuild 
  46.          Caption         =   "Build"
  47.          Height          =   255
  48.          Left            =   2880
  49.          TabIndex        =   8
  50.          Top             =   1080
  51.          Width           =   855
  52.       End
  53.       Begin VB.CommandButton BtnBrowse 
  54.          Caption         =   "Browse"
  55.          Height          =   255
  56.          Left            =   2880
  57.          TabIndex        =   7
  58.          Top             =   480
  59.          Width           =   855
  60.       End
  61.       Begin VB.TextBox TxtADO 
  62.          Height          =   285
  63.          Left            =   480
  64.          TabIndex        =   6
  65.          Top             =   1080
  66.          Width           =   2295
  67.       End
  68.       Begin VB.TextBox TxtFile 
  69.          Height          =   285
  70.          Left            =   480
  71.          TabIndex        =   5
  72.          Top             =   480
  73.          Width           =   2295
  74.       End
  75.       Begin VB.OptionButton OptADO 
  76.          Caption         =   "from ADO connection string"
  77.          Height          =   255
  78.          Left            =   240
  79.          TabIndex        =   4
  80.          Top             =   840
  81.          Width           =   2655
  82.       End
  83.       Begin VB.OptionButton OptAccessFile 
  84.          Caption         =   "from MSAccess file"
  85.          Height          =   255
  86.          Left            =   240
  87.          TabIndex        =   3
  88.          Top             =   240
  89.          Width           =   2535
  90.       End
  91.    End
  92.    Begin VB.CommandButton CancelButton 
  93.       Caption         =   "Cancel"
  94.       Height          =   375
  95.       Left            =   4680
  96.       TabIndex        =   1
  97.       Top             =   600
  98.       Width           =   1215
  99.    End
  100.    Begin VB.CommandButton OKButton 
  101.       Caption         =   "Import"
  102.       Height          =   375
  103.       Left            =   4680
  104.       TabIndex        =   0
  105.       Top             =   120
  106.       Width           =   1215
  107.    End
  108.    Begin VB.Label Label2 
  109.       Caption         =   "Query statement"
  110.       Height          =   255
  111.       Left            =   2640
  112.       TabIndex        =   11
  113.       Top             =   1800
  114.       Width           =   2055
  115.    End
  116.    Begin VB.Label Label1 
  117.       Caption         =   "Tables in database"
  118.       Height          =   255
  119.       Left            =   120
  120.       TabIndex        =   10
  121.       Top             =   1800
  122.       Width           =   2295
  123.    End
  124. Attribute VB_Name = "DlgImportDB"
  125. Attribute VB_GlobalNameSpace = False
  126. Attribute VB_Creatable = False
  127. Attribute VB_PredeclaredId = True
  128. Attribute VB_Exposed = False
  129. Public bOK As Boolean
  130. Option Explicit
  131. Private Sub BtnBrowse_Click()
  132.     Dim objDlg
  133.     Set objDlg = CreateObject("MSComDlg.CommonDialog")
  134.     objDlg.ShowOpen
  135.     If Len(objDlg.FileName) > 0 Then
  136.         TxtFile.Text = objDlg.FileName
  137.     End If
  138. End Sub
  139. Private Sub BtnBuild_Click()
  140.     Dim objADO As DataLinks
  141.     Set objADO = CreateObject("DataLinks")
  142.     If Not (objADO Is Nothing) Then
  143.         Dim objConn As Connection
  144.         Set objConn = objADO.PromptNew
  145.         TxtADO.Text = objConn.ConnectionString
  146.     End If
  147. End Sub
  148. Private Sub CancelButton_Click()
  149.     Hide
  150. End Sub
  151. Private Sub Command1_Click()
  152.     Dim objImpSettings As XMLSpyDatabaseConnection
  153.     Set objImpSettings = objSpy.GetDatabaseSettings
  154.     If OptAccessFile.Value = True Then
  155.         objImpSettings.File = TxtFile.Text
  156.     Else
  157.         objImpSettings.ADOConnection = TxtADO.Text
  158.     End If
  159.     ListTables.Clear
  160.     Dim objList As XMLSpyElementList
  161.     Dim objItem As XMLSpyElementListItem
  162.     On Error GoTo ErrorHandler
  163.     Set objList = objSpy.GetDatabaseTables(objImpSettings)
  164.     For Each objItem In objList
  165.         ListTables.AddItem objItem.Name
  166.     Next
  167.     Exit Sub
  168. ErrorHandler:
  169.     CheckForError
  170. End Sub
  171. Private Sub Form_Activate()
  172.     OptAccessFile.Value = True
  173.     UpdateSourceGrp
  174.     bOK = False
  175. End Sub
  176. Private Sub OKButton_Click()
  177.     bOK = True
  178.     Hide
  179. End Sub
  180. Private Sub OptADO_Click()
  181.     UpdateSourceGrp
  182. End Sub
  183. Private Sub OptAccessFile_Click()
  184.     UpdateSourceGrp
  185. End Sub
  186. Private Sub UpdateSourceGrp()
  187.     TxtFile.Enabled = False
  188.     BtnBrowse.Enabled = False
  189.     TxtADO.Enabled = False
  190.     BtnBuild.Enabled = False
  191.     If OptAccessFile.Value = True Then
  192.         TxtFile.Enabled = True
  193.         BtnBrowse.Enabled = True
  194.     Else
  195.         TxtADO.Enabled = True
  196.         BtnBuild.Enabled = True
  197.     End If
  198. End Sub
  199.