home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l406 / 4.ddi / CPYSTRU.FR_ / CPYSTRU.bin (.txt)
Encoding:
Visual Basic Form  |  1992-10-21  |  5.7 KB  |  202 lines

  1. VERSION 2.00
  2. Begin Form fCpyStru 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Copy Table Structure(s)"
  6.    Height          =   3570
  7.    Left            =   1710
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   3144
  10.    ScaleMode       =   0  'User
  11.    ScaleWidth      =   6012
  12.    Top             =   2010
  13.    Width           =   6105
  14.    Begin TextBox cDataBase 
  15.       Height          =   288
  16.       Left            =   4080
  17.       TabIndex        =   1
  18.       Top             =   720
  19.       Width           =   1812
  20.    End
  21.    Begin CommandButton CloseButton 
  22.       Cancel          =   -1  'True
  23.       Caption         =   "&Close"
  24.       Height          =   372
  25.       Left            =   3000
  26.       TabIndex        =   6
  27.       Top             =   2640
  28.       Width           =   2772
  29.    End
  30.    Begin CommandButton OkayButton 
  31.       Caption         =   "&OK"
  32.       Default         =   -1  'True
  33.       Height          =   372
  34.       Left            =   3000
  35.       TabIndex        =   5
  36.       Top             =   2160
  37.       Width           =   2772
  38.    End
  39.    Begin TextBox cPassword 
  40.       Height          =   288
  41.       Left            =   4080
  42.       PasswordChar    =   "*"
  43.       TabIndex        =   3
  44.       Top             =   1440
  45.       Width           =   1812
  46.    End
  47.    Begin TextBox cUserName 
  48.       Height          =   288
  49.       Left            =   4080
  50.       TabIndex        =   2
  51.       Top             =   1080
  52.       Width           =   1812
  53.    End
  54.    Begin TextBox cDBName 
  55.       Height          =   288
  56.       Left            =   4080
  57.       TabIndex        =   0
  58.       Top             =   360
  59.       Width           =   1812
  60.    End
  61.    Begin CheckBox cCopyIndexes 
  62.       BackColor       =   &H00C0C0C0&
  63.       Caption         =   "Copy Indexes"
  64.       Height          =   252
  65.       Left            =   3000
  66.       TabIndex        =   4
  67.       Top             =   1800
  68.       Value           =   1  'Checked
  69.       Width           =   1812
  70.    End
  71.    Begin ListBox cTableList 
  72.       Height          =   2565
  73.       Left            =   120
  74.       MultiSelect     =   2  'Extended
  75.       Sorted          =   -1  'True
  76.       TabIndex        =   7
  77.       Top             =   360
  78.       Width           =   2775
  79.    End
  80.    Begin Label Label2 
  81.       BackColor       =   &H00C0C0C0&
  82.       Caption         =   "Target Location:"
  83.       Height          =   252
  84.       Left            =   3120
  85.       TabIndex        =   13
  86.       Top             =   120
  87.       Width           =   1812
  88.    End
  89.    Begin Label ServerLabel 
  90.       BackColor       =   &H00C0C0C0&
  91.       Caption         =   "Server:"
  92.       Height          =   252
  93.       Left            =   3000
  94.       TabIndex        =   12
  95.       Top             =   360
  96.       Width           =   1092
  97.    End
  98.    Begin Label DataBaseLabel 
  99.       BackColor       =   &H00C0C0C0&
  100.       Caption         =   "DataBase:"
  101.       Height          =   252
  102.       Left            =   3000
  103.       TabIndex        =   11
  104.       Top             =   720
  105.       Width           =   1092
  106.    End
  107.    Begin Label PasswordLabel 
  108.       BackColor       =   &H00C0C0C0&
  109.       Caption         =   "Password:"
  110.       Height          =   252
  111.       Left            =   3000
  112.       TabIndex        =   10
  113.       Top             =   1440
  114.       Width           =   1212
  115.    End
  116.    Begin Label UserNameLabel 
  117.       BackColor       =   &H00C0C0C0&
  118.       Caption         =   "User Name:"
  119.       Height          =   252
  120.       Left            =   3000
  121.       TabIndex        =   9
  122.       Top             =   1080
  123.       Width           =   1212
  124.    End
  125.    Begin Label TableListLabel 
  126.       BackColor       =   &H00C0C0C0&
  127.       Caption         =   "Tables:"
  128.       Height          =   252
  129.       Index           =   0
  130.       Left            =   240
  131.       TabIndex        =   8
  132.       Top             =   120
  133.       Width           =   2292
  134.    End
  135. Option Explicit
  136. Sub CloseButton_Click ()
  137.   Unload Me
  138.   RefreshTables cTableList   'just in case some were added
  139. End Sub
  140. Sub Form_Load ()
  141.   Dim i As Integer
  142.   RefreshTables cTableList
  143.   cDBName = gstDBName
  144.   cDataBase = gstDataBase
  145.   cUserName = gstUserName
  146.   cPassword = gstPassword
  147. End Sub
  148. Sub OkayButton_Click ()
  149.   Dim i As Integer
  150.   Dim diff_db As Integer
  151.   Dim to_nm As String
  152.   Dim to_db As database
  153.   Dim connect As String
  154.   On Error GoTo OkayErr
  155.   MsgBar "Copying Table Structure(s)", False
  156.   If cDBName = "" Or (cDBName = gstDBName And cDataBase = gstDataBase) Then
  157.     Set to_db = gCurrentDB
  158.     diff_db = False
  159.   Else
  160.     connect = "UID=" + cUserName + ";PWD=" + cPassword
  161.     If cDataBase <> "" Then
  162.       connect = connect + ";DATABASE=" + cDataBase
  163.     End If
  164.     Set to_db = OpenDatabase(cDBName, False, False, connect)
  165.     to_db.QueryTimeout = VDMDI.cQueryTimeout
  166.     diff_db = True
  167.   End If
  168.   For i = 0 To cTableList.ListCount - 1
  169.     If cTableList.Selected(i) Then
  170.       If diff_db = False Then
  171.         to_nm = InputBox("Enter New Table Name:")
  172.         If to_nm = "" Then GoTo skipit
  173.       Else
  174.         to_nm = cTableList.List(i)
  175.       End If
  176.     Else
  177.       GoTo skipit
  178.     End If
  179.     SetHourGlass Me
  180.     If CopyStruct(gCurrentDB, to_db, (cTableList.List(i)), to_nm, (cCopyIndexes)) = True Then
  181.       ResetMouse Me
  182.       MsgBox "Copy of " + cTableList.List(i) + " Successful!"
  183.       If diff_db = False Then
  184.         cTableList.AddItem to_nm
  185.       End If
  186.     Else
  187.       ResetMouse Me
  188.       Beep
  189.       MsgBox "Copy of " + cTableList.List(i) + "UnSuccessful!"
  190.     End If
  191. skipit:
  192.   Next
  193.   GoTo OkayEnd
  194. OkayErr:
  195.   ShowError
  196.   Resume OkayEnd
  197. OkayEnd:
  198.   On Error Resume Next
  199.   to_db.Close
  200.   MsgBar "", False
  201. End Sub
  202.