home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 3_2004-2005.ISO / Data / Zips / SQL_Server1843151232005.psc / frmAlter.frm (.txt) < prev   
Encoding:
Visual Basic Form  |  2004-12-01  |  8.6 KB  |  279 lines

  1. VERSION 5.00
  2. Begin VB.Form frmAlter 
  3.    Caption         =   "Alter Table"
  4.    ClientHeight    =   4365
  5.    ClientLeft      =   60
  6.    ClientTop       =   450
  7.    ClientWidth     =   7860
  8.    Icon            =   "frmAlter.frx":0000
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   4365
  11.    ScaleWidth      =   7860
  12.    StartUpPosition =   2  'CenterScreen
  13.    Begin VB.Frame Frame3 
  14.       Caption         =   "Drop Column"
  15.       Height          =   1095
  16.       Left            =   0
  17.       TabIndex        =   12
  18.       Top             =   2520
  19.       Width           =   7815
  20.       Begin VB.CommandButton Command4 
  21.          Caption         =   "Drop"
  22.          Height          =   255
  23.          Left            =   120
  24.          TabIndex        =   15
  25.          Top             =   720
  26.          Width           =   855
  27.       End
  28.       Begin VB.ComboBox Combo2 
  29.          Height          =   315
  30.          Left            =   120
  31.          TabIndex        =   8
  32.          Text            =   "Combo2"
  33.          Top             =   360
  34.          Width           =   2295
  35.       End
  36.    End
  37.    Begin VB.Frame Frame2 
  38.       Caption         =   "Alter Column"
  39.       Height          =   1335
  40.       Left            =   0
  41.       TabIndex        =   11
  42.       Top             =   1200
  43.       Width           =   7815
  44.       Begin VB.CheckBox Check2 
  45.          Caption         =   "Allow Nulls"
  46.          Height          =   255
  47.          Left            =   6600
  48.          TabIndex        =   7
  49.          Top             =   360
  50.          Width           =   1095
  51.       End
  52.       Begin VB.TextBox Text3 
  53.          Height          =   285
  54.          Left            =   5400
  55.          TabIndex        =   6
  56.          Text            =   "Text3"
  57.          Top             =   360
  58.          Width           =   495
  59.       End
  60.       Begin VB.ComboBox Combo4 
  61.          Height          =   315
  62.          Left            =   2880
  63.          TabIndex        =   5
  64.          Text            =   "Combo3"
  65.          Top             =   360
  66.          Width           =   1935
  67.       End
  68.       Begin VB.CommandButton Command3 
  69.          Caption         =   "Alter"
  70.          Height          =   255
  71.          Left            =   120
  72.          TabIndex        =   14
  73.          Top             =   840
  74.          Width           =   855
  75.       End
  76.       Begin VB.ComboBox Combo1 
  77.          Height          =   315
  78.          Left            =   120
  79.          TabIndex        =   4
  80.          Text            =   "Combo1"
  81.          Top             =   360
  82.          Width           =   2295
  83.       End
  84.       Begin VB.Label Label2 
  85.          Caption         =   "Size"
  86.          Height          =   255
  87.          Left            =   5520
  88.          TabIndex        =   17
  89.          Top             =   120
  90.          Width           =   375
  91.       End
  92.       Begin VB.Label Label1 
  93.          Alignment       =   2  'Center
  94.          Caption         =   "Type"
  95.          Height          =   255
  96.          Left            =   2880
  97.          TabIndex        =   16
  98.          Top             =   120
  99.          Width           =   1935
  100.       End
  101.    End
  102.    Begin VB.Frame Frame1 
  103.       Caption         =   "Add Column"
  104.       Height          =   1095
  105.       Left            =   0
  106.       TabIndex        =   10
  107.       Top             =   0
  108.       Width           =   7815
  109.       Begin VB.CheckBox Check1 
  110.          Caption         =   "Allow Nulls"
  111.          Height          =   315
  112.          Left            =   6600
  113.          TabIndex        =   3
  114.          Top             =   360
  115.          Width           =   1095
  116.       End
  117.       Begin VB.TextBox Text2 
  118.          Height          =   285
  119.          Left            =   5400
  120.          TabIndex        =   2
  121.          Text            =   "Text2"
  122.          Top             =   360
  123.          Width           =   495
  124.       End
  125.       Begin VB.TextBox Text1 
  126.          Height          =   285
  127.          Left            =   120
  128.          TabIndex        =   0
  129.          Text            =   "Text1"
  130.          Top             =   360
  131.          Width           =   2295
  132.       End
  133.       Begin VB.CommandButton Command1 
  134.          Caption         =   "Add"
  135.          Height          =   255
  136.          Left            =   120
  137.          TabIndex        =   13
  138.          Top             =   720
  139.          Width           =   855
  140.       End
  141.       Begin VB.ComboBox Combo3 
  142.          Height          =   315
  143.          Left            =   2880
  144.          TabIndex        =   1
  145.          Text            =   "Combo3"
  146.          Top             =   360
  147.          Width           =   1935
  148.       End
  149.       Begin VB.Label Label4 
  150.          Caption         =   "Size"
  151.          Height          =   255
  152.          Left            =   5520
  153.          TabIndex        =   19
  154.          Top             =   120
  155.          Width           =   375
  156.       End
  157.       Begin VB.Label Label3 
  158.          Alignment       =   2  'Center
  159.          Caption         =   "Type"
  160.          Height          =   255
  161.          Left            =   2880
  162.          TabIndex        =   18
  163.          Top             =   120
  164.          Width           =   1935
  165.       End
  166.    End
  167.    Begin VB.CommandButton Command2 
  168.       Caption         =   "Done"
  169.       Height          =   375
  170.       Left            =   3360
  171.       TabIndex        =   9
  172.       Top             =   3840
  173.       Width           =   1095
  174.    End
  175. Attribute VB_Name = "frmAlter"
  176. Attribute VB_GlobalNameSpace = False
  177. Attribute VB_Creatable = False
  178. Attribute VB_PredeclaredId = True
  179. Attribute VB_Exposed = False
  180. Public AlterType As String
  181. Private Sub Combo3_Change()
  182. Select Case Combo3.Text
  183.    Case "binary", "char", "nchar", "nvarchar", "varbinary", "varchar"
  184.       Text2.Enabled = True
  185.    Case Else
  186.       Text2.Enabled = False
  187. End Select
  188. End Sub
  189. Private Sub Combo3_Click()
  190. Select Case Combo3.Text
  191.    Case "binary", "char", "nchar", "nvarchar", "varbinary", "varchar"
  192.       Text2.Enabled = True
  193.    Case Else
  194.       Text2.Enabled = False
  195. End Select
  196. End Sub
  197. Private Sub Combo4_Change()
  198. Select Case Combo4.Text
  199.    Case "binary", "char", "nchar", "nvarchar", "varbinary", "varchar"
  200.       Text3.Enabled = True
  201.    Case Else
  202.       Text3.Enabled = False
  203. End Select
  204. End Sub
  205. Private Sub Combo4_Click()
  206. Select Case Combo4.Text
  207.    Case "binary", "char", "nchar", "nvarchar", "varbinary", "varchar"
  208.       Text3.Enabled = True
  209.    Case Else
  210.       Text3.Enabled = False
  211. End Select
  212. End Sub
  213. Private Sub Command1_Click()
  214. If Text1.Text = "" Then
  215.    MsgBox "Enter New Column Name."
  216.    Exit Sub
  217. End If
  218. On Error GoTo errorfound
  219. Set conn = New adodb.Connection
  220. Set cmd1 = New adodb.Command
  221. strConnect = "Provider=SQLOLEDB;server=" + Server + ";database=" + DBName + ";uid=" + UID + ";pwd=" + PWD + ";"
  222. conn.Open strConnect
  223. cmd1.ActiveConnection = conn
  224. Sql = "Alter table " + TableName + " add " + Text1.Text + " " + Combo3.Text
  225. Select Case Combo3.Text
  226.    Case "binary", "char", "nchar", "nvarchar", "varbinary", "varchar"
  227.       binaryoece34Lr"
  228. Btab0rchar"
  229.       Text2.Enablenn = Ne     Tele " + TableName + " 
  230.     Tele " + TableName + " 
  231.     Tele " + TableName + " 
  232.     TelN" +  + Txcl0S+ " 
  233.     TelN" +  + Txcl03= Fb Else
  234.       T3rclN" +  + Txc", "varchar"
  235.       binarl+ Txc", "varchar"
  236.       binarl+ Txc", "varchar"
  237.       binarl+ Txc", "varchar"
  238. I    e"
  239.       Width          
  240. I    e"
  241.  95dGAsrchar", "varbieclaredI2 DBN3gU  
  242.  lobalNamu   xc", CommanText3.EConnection = conn
  243. Sql = "Alter C    binaPWD + ";"
  244. conn.Open strConnect0m 6I;nrarbieclaredI2 DBN3
  245.       binheBlt
  246.     se
  247.       Text$o0)NamGxE e"
  248.       binarl+ Y2 DBN3gU  
  249.  lobalNbinary8iext + " " + Combo3.Text
  250. Select Case Combo3.Text
  251.    Case "binary", "ch= xt
  252.   ), "va Combo4.Text
  253.    Case "binary",nection = conn
  254. Sql = "Alter C    binaPWD + ";"
  255. conn.Open strConnect0m 6I;nrarbieclareda  
  256.  leLm 6I;nrarbkonn
  257. Sqlary", "ch= xt);nrarnnec  binarl+ T "ch= xt);nrarnnec  binar1n.Open strConnect0m 6I;nrPar"da  
  258.  leLm 6I6I;nrPar"daTxc", "varchar"
  259.       binarl+ Txc", "varchar"
  260.       bin"GrTxcCI2Enrarbihar"
  261.       biyn"GrTxcC1rrarbihar"
  262.       biyn"GrTxcC1rrarbihar"
  263.       biyn"GrTx1n.Open strConnect0m 6I;nrPlaredIcfsCtribute VB_GlobalNameSpace = Faary)ce = Faary)ce = Faary)ce = Faary)ce = Faary)ce = Faary)ce = Faary)ce = Faary)ce = Faary)ce = Faary)ce = FolNb"
  264.   Y,ner     biyn"GrTFaary)ce = FolNb"
  265.   Y,ner = FolN7 = Faary)crTFaary)ce = FolNb"
  266.   Y,ner = Fo" + UIDolNb"
  267. 4 nY,ner = Fo" + UIDolNb"
  268. 4 nY6WD + ";"
  269. conn.OpenUm nY6WD + ";"
  270. con + )ce =1ce NY6WD +Cr"da  
  271.  leLm 6e = Faary)c4i" + TableName + "ase "binary"m lex e"
  272.       Width          
  273. Il1  TS      Width          
  274. d4rCon nY,neo" +  Width binarl+ Txc", "varchar"
  275.   o " + 6nx2 
  276. Il aH"
  277. Qr "ase "bin sm lex e"
  278. Htaar ,nye "se "bin = F
  279.