0$房天下问答|求 VB代码 加注释$https://m.fang.com/ask/ask_695312.html$https://static.soufunimg.com/common_m/m_public/201511/images/asksharedefault.png
packc/pages/ask/detail/detail?askid=695312
-
求 VB代码 加注释
Private Sub an_Click()If an.Caption = "搜索" Thena = ""If Trim(xm.Text) <> "" Thena = "where 姓名 = " + Trim(xm.Text)End IfIf Trim(xh.Text) <> "" ThenIf a <> "" Thena = a + " and"Elsea = a + "where"End Ifa = a + " 学号 = " + Trim(xh.Text)End IfAdodc1.RecordSource = "select * from student " + aAdodc1.Refreshan.Caption = "删除"Else If MsgBox("是否要删除此信息?", vbYesNo, "提示") = vbYes Then If MsgBox("真的要删除此信息?", vbYesNo, "提示") = vbYes Then If MsgBox("确定要删除此信息?", vbYesNo, "提示") = vbYes Then Adodc1.Recordset.Delete Else an.Caption = "搜索" End If Else an.Caption = "搜索" End If Else an.Caption = "搜索" End Ifan.Caption = "搜索"xm.Text = ""xh.Text = ""End IfEnd Sub
更多
提问者:jay61132
发布于2010-09-19
共1个回答
-
-
-
karwan
丨Lv 4
Private Sub an_Click()If an.Caption = "搜索" Thena = ""If Trim(xm.Text) <> "" Thena = "where 姓名 = " + Trim(xm.Text)End IfIf Trim(xh.Text) <> "" ThenIf a <> "" Thena = a + " and"Elsea = a + "where"End Ifa = a + " 学号 = " + Trim(xh.Text)End IfAdodc1.RecordSource = "select * from student " + aAdodc1.Refreshan.Caption = "删除"Else If MsgBox("是否要删除此信息?", vbYesNo, "提示") = vbYes Then If MsgBox("真的要删除此信息?", vbYesNo, "提示") = vbYes Then If MsgBox("确定要删除此信息?", vbYesNo, "提示") = vbYes Then Adodc1.Recordset.Delete Else an.Caption = "搜索" End If Else an.Caption = "搜索" End If Else an.Caption = "搜索" End Ifan.Caption = "搜索"xm.Text = ""xh.Text = ""End IfEnd Sub //点击an按钮,如果这个按钮的标题是“搜索”,那么根据xm和xh的text值,来查询学生信息,如果按钮的标题是“删除”,就把这个记录删除。
免责声明:问答内容均来源于互联网用户,房天下对其内容不负责任,如有版权或其他问题可以联系房天下进行删除。

关注成功