Option Explicit
Private Sub Command1_Click()
Adodc1.Recordset.Fields("姓名") = Trim(Text1.Text)
Adodc1.Recordset.Fields("学号") = Trim(Text2.Text)
Adodc1.Recordset.Fields("电话") = Trim(Text3.Text)
Adodc1.Recordset.Fields("地址") = Trim(Text4.Text)
Adodc1.Recordset.Update
End Sub
Private Sub Command2_Click()
Dim YN As Integer
YN = MsgBox("确定删除?", vbYesNo)
If YN = 6 Then Adodc1.Recordset.Delete
End Sub
Private Sub Command3_Click()
Adodc1.Recordset.Fields("姓名") = Trim(Text1.Text)
Adodc1.Recordset.Fields("学号") = Trim(Text2.Text)
Adodc1.Recordset.Fields("电话") = Trim(Text3.Text)
Adodc1.Recordset.Fields("地址") = Trim(Text4.Text)
End Sub
Private Sub Command4_Click()
Adodc1.Recordset.CancelUpdate
Adodc1.Refresh
End Sub
Private Sub Command5_Click()
End
End Sub
Private Sub Command6_Click()
Adodc1.Recordset.AddNew
End Sub
Private Sub Command7_Click()
Adodc1.Recordset.Find Combo1.Text & "= '" & Trim(Text5) & "'", , , 1
If Adodc1.Recordset.EOF Then MsgBox "查找不到!!", , "提示"
End Sub
Private Sub Form_Load()
Dim constr As String
constr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\data.mdb" & ";Persist Security Info=False"
Adodc1.ConnectionString = constr
Adodc1.CommandType = adCmdUnknown
Adodc1.RecordSource = "select * from 通讯录"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
End Sub
本文链接:https://www.kinber.cn/post/3717.html 转载需授权!
推荐本站淘宝优惠价购买喜欢的宝贝: