📄 fields.ebf
字号:
VERSION 5.00
Begin VB.Form fields
Appearance = 0 'Flat
BackColor = &H80000000&
Caption = "新增加字段信息"
ClientHeight = 3375
ClientLeft = 60
ClientTop = 345
ClientWidth = 3930
FillColor = &H00C0E0FF&
BeginProperty Font
Name = "Tahoma"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000005&
ScaleHeight = 3375
ScaleWidth = 3930
Begin VBCE.CommandButton but_cancel
Height = 375
Left = 1680
TabIndex = 5
Top = 1080
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.CommandButton but_ok
Height = 375
Left = 360
TabIndex = 4
Top = 1080
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.ComboBox cb_fieldtype
Height = 300
Left = 960
TabIndex = 3
Top = 480
Width = 1815
List = "fields.frx":0000
ItemData = "fields.frx":0028
_cx = 3201
_cy = 529
BackColor = -2147483643
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
Begin VBCE.Label Label2
Height = 375
Left = 0
TabIndex = 2
Top = 480
Width = 975
_cx = 1720
_cy = 661
AutoSize = 0 'False
BackColor = -2147483648
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.TextBox tx_newfiledname
Height = 375
Left = 960
TabIndex = 1
Top = 0
Width = 1815
_cx = 3201
_cy = 661
BackColor = -2147483643
BorderStyle = 1
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 = "ab"
Alignment = 0
HideSelection = -1 'True
Locked = 0 'False
MaxLength = 0
MultiLine = 0 'False
PasswordChar = ""
ScrollBars = 0
End
Begin VBCE.Label Label1
Height = 375
Left = 0
TabIndex = 0
Top = 0
Width = 975
_cx = 1720
_cy = 661
AutoSize = 0 'False
BackColor = -2147483648
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
End
Attribute VB_Name = "fields"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub but_cancel_Click()
fields.Visible = False
End Sub
Private Sub but_ok_Click()
If Not table.State = adStateClosed Then
table.Close
End If
Dim sql As String
Dim i As Integer
If Len(Trim(tx_newfiledname.Text)) = 0 Then
MsgBox "请输入新字段名称", vbCritical, "提示"
Exit Sub
ElseIf Len(cb_fieldtype.Text) = 0 Then
MsgBox "请选择新字段类型", vbCritical, "提示"
Exit Sub
End If
For i = 0 To UBound(fieldarray) - 1
If Trim(tx_newfiledname.Text) = Trim(fieldarray(i)) Then
MsgBox "该字段已经存在,请输入其他名字", vbOKCancel + vbInformation, "增加字段"
Exit Sub
End If
Next
sql = "alter table " & Form1.cb_table.List(Form1.cb_table.ListIndex) & " add " & tx_newfiledname.Text & " " & cb_fieldtype.List(cb_fieldtype.ListIndex)
If vbOK = MsgBox(sql, vbQuestion + vbOKCancel, "是否增加字段") Then
Connection.Execute sql
If Err.Number > 0 Then
MsgBox "字段添加错误,请检查", vbOKOnly, "增加字段错误"
Else
MsgBox "添加成功", vbOKOnly, "增加字段成功"
fields.Visible = False
fields.Show
End If
Else
Exit Sub
End If
End Sub
Private Sub Form_Load()
cb_fieldtype.AddItem "Varchar"
cb_fieldtype.AddItem "Text"
cb_fieldtype.AddItem "Varbinary"
cb_fieldtype.AddItem "Varchar"
cb_fieldtype.AddItem "smallint"
cb_fieldtype.AddItem "Float"
cb_fieldtype.AddItem "DateTime"
cb_fieldtype.AddItem "Bit"
cb_fieldtype.AddItem "Uint"
cb_fieldtype.AddItem "Usmallint"
cb_fieldtype.AddItem "int"
cb_fieldtype.ListIndex = 1
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -