📄 editform.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form addform
BorderStyle = 1 'Fixed Single
Caption = "addform"
ClientHeight = 2760
ClientLeft = 45
ClientTop = 435
ClientWidth = 4875
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2760
ScaleWidth = 4875
StartUpPosition = 2 '屏幕中心
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 240
Top = 600
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=pubs;Data Source=COMP20"
OLEDBString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=pubs;Data Source=COMP20"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = "sa"
Password = ""
RecordSource = "select authors.au_id,authors.au_lname,authors.au_fname,authors.contract from authors"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.CommandButton Command2
Caption = "放弃"
Height = 375
Left = 2640
TabIndex = 9
Top = 1920
Width = 855
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 1320
TabIndex = 8
Top = 1920
Width = 855
End
Begin VB.ComboBox Combo1
DataField = "contract"
BeginProperty DataFormat
Type = 5
Format = ""
HaveTrueFalseNull= 1
TrueValue = "已签合同"
FalseValue = "未签合同"
NullValue = ""
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 7
EndProperty
DataSource = "Adodc1"
Height = 300
Left = 3360
TabIndex = 7
Text = "已签合同"
Top = 960
Width = 1095
End
Begin VB.TextBox Text3
DataField = "au_fname"
DataSource = "Adodc1"
Height = 300
Left = 1200
TabIndex = 2
Text = "Text3"
Top = 960
Width = 975
End
Begin VB.TextBox Text2
DataField = "au_lname"
DataSource = "Adodc1"
Height = 300
Left = 3120
TabIndex = 1
Text = "Text2"
Top = 240
Width = 1335
End
Begin VB.TextBox Text1
DataField = "au_id"
BeginProperty DataFormat
Type = 1
Format = "874-98-5623"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
DataSource = "Adodc1"
Height = 300
Left = 1200
TabIndex = 0
Text = "Text1"
Top = 240
Width = 1215
End
Begin VB.Line Line1
X1 = 1080
X2 = 4800
Y1 = 1440
Y2 = 1440
End
Begin VB.Label Label1
Caption = "作者标识号:"
Height = 255
Left = 120
TabIndex = 3
Top = 360
Width = 1095
End
Begin VB.Image Image1
Height = 900
Left = 0
Picture = "editform.frx":0000
Top = 1320
Width = 900
End
Begin VB.Label Label4
Caption = "合同状态:"
Height = 255
Left = 2400
TabIndex = 6
Top = 1080
Width = 975
End
Begin VB.Label Label3
Caption = "名:"
Height = 255
Left = 840
TabIndex = 5
Top = 1080
Width = 375
End
Begin VB.Label Label2
Caption = "姓:"
Height = 255
Left = 2760
TabIndex = 4
Top = 360
Width = 375
End
End
Attribute VB_Name = "addform"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
On Error GoTo err_line
'Set rs1 = New Adodb.Recordset
' Set cmm1 = New Adodb.Command
' cmm1.ActiveConnection = cnn
' cmm1.CommandText = "SELECT au_id,au_fname,au_lname,contract from authors"
' cmm1.CommandType = adCmdText
' rs1.CursorLocation = adUseClient
' rs1.Open cmm1, , adOpenDynamic, adLockOptimistic
'Set rs = New Adodc.Recordset
'rs.AddNew
'If Not Text1.Text = "" Then rs1.Fields("au_id") = Text1.Text
'If Not Text2.Text = "" Then rs1.Fields("au_lname") = Text2.Text
'If Not Text3.Text = "" Then rs1.Fields("au_fname") = Text3.Text
'If Combo1.Text = "已签合同" Then rs1.Fields("contract") = -1
'If Combo1.Text = "未签合同" Then rs1.Fields("contract") = 0
'rs.Update
'GoTo okline
Adodc1.Recordset.AddNew
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
MsgBox "成功添加!", vbInformation, "提示"
authors_show.DataGrid1.Refresh
GoTo okline
err_line:
MsgBox "数据插入失败!", vbSystemModal, "添加操作"
On Error GoTo 0
okline:
End Sub
Private Sub Command2_Click()
authors_show.Adodc1.Refresh
Unload addform
End Sub
Private Sub Form_Load()
Combo1.AddItem "已签合同"
Combo1.AddItem "未签合同"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Combo1.Text = "已签合同"
str1 = "Provider=SQLOLEDB.1;Password=" + mima + ";Persist Security Info=False;User ID=" + sa + ";Initial Catalog=pubs;Data Source=" + shuju
Adodc1.ConnectionString = str1
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -