本文介绍了通过按钮删除需要协助ADODB删除过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我是这个框架网站的新手,我正在使用vb.net,我的代码如上所述请一些人帮助我。 它给了我错误 我尝试过: 私有 Sub Button6_Click(发件人作为 对象,e As EventArgs)句柄 Button6.Click Rss = 新 ADODB.Recordset Rss.Open( DELETE FROM Employee WHERE Serial_No =' txtSNo.Text.Trim ',CON) Rss.Delete( Serial_No) Rss.Delete( Employee_Name) Rss.Delete( F_Name ) Rss.Delete( 名称) Rss.Delete( dept_Name) MsgBox( 记录已成功删除,MsgBoxStyle.Information,strprojectname) Rss.Close() 结束 Sub 解决方案 根据我的评论,您需要将记录集移动到要删除的记录,假设Serial_No是唯一标识符; 私有 Sub Button6_Click(发件人正如 Objec t ,e As EventArgs)句柄 Button6.Click Rss = 新 ADODB.Recordset Rss.Open( SELECT * FROM Employee WHERE Serial_No =' txtSNo.Text.Trim ',CON,CursorTypeEnum.adOpenDynamic,LockTypeEnum.adLockOptimistic) 如果 Rss.BOF = True 和 Rss.EOF = True 然后 MsgBox( 找不到记录) Else Rss.Delete MsgBox( 记录已成功删除,MsgBoxStyle.Information,strprojectname) 结束 如果 Rss.Close() 结束 Sub I am new to this framework site i am working on vb.net and my codes as above please some one help me.its gives me errorsWhat I have tried:Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click Rss = New ADODB.Recordset Rss.Open("DELETE FROM Employee WHERE Serial_No = '" txtSNo.Text.Trim "'", CON) Rss.Delete("Serial_No") Rss.Delete("Employee_Name") Rss.Delete("F_Name") Rss.Delete("Designation") Rss.Delete("Dept_Name") MsgBox("Record Deleted Successfully", MsgBoxStyle.Information, strprojectname) Rss.Close()End Sub 解决方案 As per my comment, you need to move the recordset to the record you want to delete, assuming that Serial_No is a unique identifier;Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click Rss = New ADODB.Recordset Rss.Open("SELECT * FROM Employee WHERE Serial_No = '" txtSNo.Text.Trim "'", CON, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic) If Rss.BOF = True And Rss.EOF = True Then MsgBox("Record Not Found") Else Rss.Delete MsgBox("Record Deleted Successfully", MsgBoxStyle.Information, strprojectname) End If Rss.Close()End Sub 这篇关于通过按钮删除需要协助ADODB删除过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-26 18:14