📄 form1.ebf
字号:
VERSION 5.00
Object = "{532C2BF5-6B55-11D1-9AA5-00C04FAD5AEC}#1.0#0"; "MSCEGRID.DLL"
Begin VB.Form Form1
Appearance = 0 'Flat
BackColor = &H00FFC0FF&
Caption = "Form1"
ClientHeight = 4815
ClientLeft = 60
ClientTop = 840
ClientWidth = 3855
ForeColor = &H80000008&
ScaleHeight = 4815
ScaleWidth = 3855
ShowOK = -1 'True
Begin GRIDLibCtl.GridCtrl datagrid
Height = 3135
Left = 0
TabIndex = 0
Top = 360
Width = 3495
_cx = 6165
_cy = 5530
BackColor = 16777215
BackColorBkg = 8421504
BackColorSel = 6956042
Cols = 2
FillStyle = 0
FocusRect = 1
ForeColor = 0
ForeColorSel = 16777215
GridColor = 12632256
GridLines = 1
GridLineWidth = 1
HighLight = 1
Redraw = -1 'True
RowHeightMin = 0
Rows = 2
ScrollBars = 3
ScrollTrack = 0 'False
SelectionMode = 0
TextStyle = 0
WordWrap = 0 'False
Enabled = -1 'True
End
Begin VBCE.CommandButton addfield
Height = 375
Left = 600
TabIndex = 4
Top = 3720
Width = 855
_cx = 1508
_cy = 661
BackColor = 12632256
Caption = "删除字段"
Enabled = -1 'True
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Tahoma"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Style = 0
End
Begin VBCE.CommandButton but_tuicu
Height = 375
Left = 1800
TabIndex = 3
Top = 3720
Width = 975
_cx = 1720
_cy = 661
BackColor = 12632256
Caption = "退 出"
Enabled = -1 'True
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Tahoma"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Style = 0
End
Begin VBCE.Label Label1
Height = 255
Left = 0
TabIndex = 2
Top = 0
Width = 615
_cx = 1085
_cy = 450
AutoSize = 0 'False
BackColor = -2147483645
BackStyle = 1
BorderStyle = 0
Caption = "表名"
Enabled = -1 'True
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Tahoma"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = -2147483640
Alignment = 0
UseMnemonic = -1 'True
WordWrap = 0 'False
End
Begin VBCE.ComboBox cb_table
Height = 300
Left = 600
TabIndex = 1
Top = 0
Width = 1935
List = "Form1.frx":0000
ItemData = "Form1.frx":0028
_cx = 3413
_cy = 529
BackColor = 16761024
Enabled = -1 'True
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Tahoma"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = -2147483640
Text = ""
IntegralHeight = -1 'True
Locked = 0 'False
Sorted = 0 'False
Style = 0
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub addfield_Click()
If datagrid.RowSel < 0 Then
MsgBox "选择字段", vbOKOnly, "提醒"
Exit Sub
ElseIf datagrid.RowSel = 0 Then
MsgBox "不能选择系统结构字段名称", vbOKOnly + vbCritical, "提醒"
Exit Sub
End If
Dim tem As String
tem = datagrid.TextMatrix(datagrid.RowSel, 0)
If Not table.State = adStateClosed Then
table.Close
End If
Dim okornot As Integer
Dim sql As String
okornot = MsgBox("是否重新命名字段" & datagrid.TextMatrix(datagrid.RowSel, 0), vbOKCancel, "提醒")
If okornot = vbOK Then
sql = "ALTER TABLE " & cb_table.List(cb_table.ListIndex) & " DROP " & datagrid.TextMatrix(datagrid.RowSel, 0)
If vbOK = MsgBox(sql, vbQuestion + vbOKCancel, "是否重新命名字段") Then
Connection.Execute sql
If Err.Number > 0 Then
MsgBox "重新命名字段错误", vbOKOnly, "是否重新命名字段"
Else
MsgBox "重新命名字段成功", vbOKOnly, "是否重新命名字段"
End If
Else
Exit Sub
End If
End If
End Sub
Private Sub but_tuicu_Click()
App.End
End Sub
Private Sub cb_table_Click()
If Not table.State = adStateClosed Then
table.Close
End If
table.Open cb_table.List(cb_table.ListIndex), Connection
If table.BOF And table.EOF Then
MsgBox cb_table.ListIndex & " 没有任何记录", vbOKOnly, "注意"
Exit Sub
ElseIf Len(cb_table.List(cb_table.ListIndex)) = 0 Then
Exit Sub
Else
showallfieldshasarray Form1
End If
End Sub
Private Sub Form_Load()
If Not table.State = adStateClosed Then
table.Close
End If
table.Open "MSysTables", Connection
table.MoveFirst
Do While Not table.EOF
If table.fields("TableName") <> "MSysTables" And _
table.fields("TableName") <> "MSysFields" And _
table.fields("TableName") <> "MSysIndexes" And _
table.fields("TableName") <> "MSysProcs" Then
cb_table.AddItem table.fields("TableName")
End If
table.MoveNext
Loop
cb_table.ListIndex = 0
If Not table.State = adStateClosed Then
table.Close
table.Open cb_table.List(cb_table.ListIndex), Connection
showallfieldshasarray Form1
End If
End Sub
Private Sub Form_OKClick()
App.End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -