📄 gxtushuxinxi.frm
字号:
Caption = "性别:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 1200
TabIndex = 20
Top = 1800
Width = 720
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "姓名:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 1200
TabIndex = 18
Top = 1200
Width = 720
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "请输入学号:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 480
TabIndex = 15
Top = 600
Width = 1440
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "简介:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = -74040
TabIndex = 10
Top = 3120
Width = 720
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "类别:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = -74040
TabIndex = 9
Top = 2640
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "出版社:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = -74280
TabIndex = 7
Top = 2040
Width = 960
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "作者:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = -74040
TabIndex = 5
Top = 1560
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "书名:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = -74040
TabIndex = 3
Top = 1080
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "请输入书号:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = -74760
TabIndex = 1
Top = 600
Width = 1440
End
End
End
Attribute VB_Name = "gxtushuxinxi"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Private Sub Command1_Click()
If Text1.Text = "" Then
MsgBox "书号不能为空!", vbCritical, "错误"
Text1.Text = ""
Text1.SetFocus
Exit Sub
End If
If IsNumeric(Text1.Text) Then
Else
MsgBox "书号必须为数字!请注意!!", vbCritical, "错误"
Text1.Text = ""
Text1.SetFocus
Exit Sub
End If
'查询DataEnv.rsstu的状态,如果已经打开,则先关闭
If rs.State = 1 Then rs.Close
str2 = "select * from book where bno = '" & Text1.Text & "'"
rs.Open str2, cn, 1, 3
If rs.EOF Then
MsgBox "无该记录或输入数据有误。请查正。", vbCritical, "错误"
Text1.Text = ""
Text1.SetFocus
Exit Sub
Else
Text2.Text = rs!bname
Text3.Text = rs!auth
Text4.Text = rs!press
Combo2.Text = rs!part
Text6.Text = rs!jianjie
Command2.Enabled = True
End If
End Sub
Private Sub Command2_Click()
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Combo1.Text = "" Then
MsgBox "请完整输入必要字段,简介可以不填。", vbCritical, "错误"
Text1.SetFocus
Exit Sub
Else
'rs.AddNew
rs!bno = Text1.Text
rs!bname = Text2.Text
rs!auth = Text3.Text
rs!press = Text4.Text
rs!part = Combo1.Text
rs!jianjie = Text6.Text
rs.Update
MsgBox "记录已更新。"
End If
rs.Close
End Sub
Private Sub Command3_Click()
Unload Me
cn.Close
End Sub
Private Sub Command4_Click()
If Text7.Text = "" Then
MsgBox "学号不能为空!", vbCritical, "错误"
Text7.Text = ""
Text7.SetFocus
Exit Sub
End If
If IsNumeric(Text7.Text) Then
Else
MsgBox "学号必须为数字!请注意!!", vbCritical, "错误"
Text7.Text = ""
Text7.SetFocus
Exit Sub
End If
'查询DataEnv.rsstu的状态,如果已经打开,则先关闭
If rs.State = 1 Then rs.Close
str2 = "select * from stu where sno = '" & Text7.Text & "'"
rs.Open str2, cn, 1, 3
If rs.EOF Then
MsgBox "无该记录或输入数据有误。请查正。", vbCritical, "错误"
Text1.Text = ""
Text1.SetFocus
Exit Sub
Else
Text8.Text = rs!sname
Text9.Text = rs!sex
Text10.Text = rs!sclass
Combo1.Text = rs!dept
Text12.Text = rs!beizhu
Command5.Enabled = True
End If
End Sub
Private Sub Command5_Click()
If Text7.Text = "" Or Text8.Text = "" Or Text9.Text = "" Or Text10.Text = "" Or Combo2.Text = "" Then
MsgBox "请完整输入必要字段,备注可以不填。", vbCritical, "错误"
Text7.SetFocus
Exit Sub
Else
strSQL = "select * from book"
On Error Resume Next
'查询DataEnv.rsstu的状态,如果已经打开,则先关闭
If rs.State = adStateOpen Then rs.Close
rs.Open strSQL, cn, 1, 3
'rs.AddNew
rs!sno = Text7.Text
rs!sname = Text8.Text
rs!sex = Text9.Text
rs!sclass = Text10.Text
rs!dept = Combo2.Text
rs!beizhu = Text12.Text
rs.Update
MsgBox "记录已更新。"
End If
rs.Close
End Sub
Private Sub Command6_Click()
Unload Me
cn.Close
End Sub
Private Sub Form_Load()
Combo1.AddItem "计算机系"
Combo1.AddItem "电子信息系"
Combo1.AddItem "化学系"
Combo1.AddItem "美术系"
Combo1.AddItem "社会管理系"
Combo1.AddItem "生物系"
Combo1.AddItem "数学系"
Combo1.AddItem "体育系"
Combo1.AddItem "物理系"
Combo1.AddItem "音乐系"
Combo1.AddItem "中文系"
Combo2.AddItem "计算机类"
Combo2.AddItem "电子信息类"
Combo2.AddItem "化学类"
Combo2.AddItem "美术类"
Combo2.AddItem "社会管理类"
Combo2.AddItem "生物类"
Combo2.AddItem "数学类"
Combo2.AddItem "体育类"
Combo2.AddItem "物理类"
Combo2.AddItem "音乐类"
Combo2.AddItem "中文类"
Command2.Enabled = False
Command5.Enabled = False
If cn.State = 1 Then cn.Close
'根据目录所在的位置,改变ADO所使用的的连接字符串
Dim strConn As String
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Password=;Data Source="
'使用相对路径
strConn = strConn & App.Path & "\database\manager.mdb" & ";Persist Security Info=True"
cn.ConnectionString = strConn
cn.Open
'Set rs = DataEn.rsstu
strSQL = "select * from book"
On Error Resume Next
'查询DataEnv.rsstu的状态,如果已经打开,则先关闭
If rs.State = adStateOpen Then rs.Close
rs.Open strSQL, cn, 1, 3
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -