首先通过查询按钮,查询出需要修改的数据库信息显示在已经设置好的文本框中,然后在文本框中修改查询出的数据后,点击保存按钮,将更新数据库中的原记录.请问如何实现保存?请高手写一下代码.以下是我的代码:
1.点修改记录按钮后的代码
Command1(0).Enabled = False: Command1(2).Enabled = False: Command1(3).Enabled = False: Frame2.Enabled = True
Text2.SetFocus
k = MsgBox("请输入你要修改信息的学生学号或姓名", vbInformation + vbOKOnly, "修改")
Call Command3_Click
Command3_Click是实现查询的代码:
Private Sub Command3_Click()
Data1.RecordSource = "select * from Student where ((Student.学号 like " + Chr(34) + Text2.Text + "*" + Chr(34) + ")or(Student.姓名 like " + Chr(34) + Text2.Text + "*" + Chr(34) + "))"
Data1.Refresh
Text1(0).Text = Data1.Recordset.Fields("学号")
Text1(1).Text = Data1.Recordset.Fields("姓名")
Combo1(0).Text = Data1.Recordset.Fields("性别")
Text1(2).Text = Data1.Recordset.Fields("民族")
Text1(3).Text = Data1.Recordset.Fields("籍贯")
Combo1(1).Text = Data1.Recordset.Fields("层次")
Combo1(2).Text = Data1.Recordset.Fields("专业")
Text1(4).Text = Data1.Recordset.Fields("出生日期")
Text1(5).Text = Data1.Recordset.Fields("文化程度")
Text1(6).Text = Data1.Recordset.Fields("毕业学校")
Text1(7).Text = Data1.Recordset.Fields("工作单位")
Text1(8).Text = Data1.Recordset.Fields("E-mail")
Text1(9).Text = Data1.Recordset.Fields("联系电话")
Text1(10).Text = Data1.Recordset.Fields("入学时间")
Text1(11).Text = Data1.Recordset.Fields("免修课程")
Text1(12).Text = Data1.Recordset.Fields("录取通知书号")
End Sub