home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 October / Chip_2000-10_cd1.bin / tema / telefony / Remote_DB.ctl < prev    next >
Encoding:
Text File  |  2000-01-09  |  3.3 KB  |  116 lines

  1. VERSION 5.00
  2. Object = "{00028C01-0000-0000-0000-000000000046}#1.0#0"; "DBGRID32.OCX"
  3. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  4. Begin VB.UserControl Remote_DB 
  5.    ClientHeight    =   4905
  6.    ClientLeft      =   0
  7.    ClientTop       =   0
  8.    ClientWidth     =   6345
  9.    ScaleHeight     =   4905
  10.    ScaleWidth      =   6345
  11.    Begin MSDBGrid.DBGrid DBGrid1 
  12.       Bindings        =   "Remote_DB.ctx":0000
  13.       Height          =   3255
  14.       Left            =   120
  15.       OleObjectBlob   =   "Remote_DB.ctx":0014
  16.       TabIndex        =   0
  17.       Top             =   1080
  18.       Width           =   6135
  19.    End
  20.    Begin VB.CommandButton Command2 
  21.       Caption         =   "Refresh"
  22.       Height          =   375
  23.       Left            =   5400
  24.       TabIndex        =   5
  25.       Top             =   600
  26.       Width           =   855
  27.    End
  28.    Begin VB.ComboBox tabulky 
  29.       Height          =   315
  30.       Left            =   2520
  31.       TabIndex        =   4
  32.       Text            =   "Combo1"
  33.       Top             =   600
  34.       Width           =   2775
  35.    End
  36.    Begin MSComDlg.CommonDialog Soubor 
  37.       Left            =   5520
  38.       Top             =   3600
  39.       _ExtentX        =   847
  40.       _ExtentY        =   847
  41.       _Version        =   393216
  42.    End
  43.    Begin VB.TextBox Text1 
  44.       Height          =   375
  45.       Left            =   2520
  46.       TabIndex        =   2
  47.       Top             =   120
  48.       Width           =   3735
  49.    End
  50.    Begin VB.CommandButton Command1 
  51.       Caption         =   "Nalistuj databßzi"
  52.       Height          =   375
  53.       Left            =   120
  54.       TabIndex        =   1
  55.       Top             =   120
  56.       Width           =   2295
  57.    End
  58.    Begin VB.Data Data1 
  59.       Caption         =   "Data1"
  60.       Connect         =   "Access"
  61.       DatabaseName    =   ""
  62.       DefaultCursorType=   0  'DefaultCursor
  63.       DefaultType     =   2  'UseODBC
  64.       Exclusive       =   0   'False
  65.       Height          =   375
  66.       Left            =   120
  67.       Options         =   0
  68.       ReadOnly        =   0   'False
  69.       RecordsetType   =   1  'Dynaset
  70.       RecordSource    =   ""
  71.       Top             =   4440
  72.       Width           =   6135
  73.    End
  74.    Begin VB.Label Label1 
  75.       Caption         =   "Seznam tabulek v databßzi"
  76.       Height          =   375
  77.       Left            =   120
  78.       TabIndex        =   3
  79.       Top             =   600
  80.       Width           =   2295
  81.    End
  82. End
  83. Attribute VB_Name = "Remote_DB"
  84. Attribute VB_GlobalNameSpace = False
  85. Attribute VB_Creatable = True
  86. Attribute VB_PredeclaredId = False
  87. Attribute VB_Exposed = True
  88. Private Sub Command1_Click()
  89.     On Error GoTo chyba
  90.     Soubor.CancelError = True
  91.     Soubor.DefaultExt = "*.mdb"
  92.     Soubor.ShowOpen
  93.     a = Soubor.FileName
  94.     If a = "" Then GoTo chyba
  95.     Text1.Text = a
  96.     Data1.DatabaseName = a
  97.     For i = 0 To tabulky.ListCount - 1
  98.         tabulky.RemoveItem 0
  99.     Next i
  100.     Dim db As Database
  101.     Set db = OpenDatabase(a)
  102.     For i = 0 To db.TableDefs.Count - 1
  103.         tabulky.AddItem db.TableDefs(i).Name
  104.     Next i
  105.     Exit Sub
  106. chyba:
  107.     MsgBox Error
  108. End Sub
  109.  
  110. Private Sub Command2_Click()
  111.     On Error Resume Next
  112.     Data1.RecordSource = tabulky.Text
  113.     Data1.Refresh
  114. End Sub
  115.  
  116.