AM无法删除记录 [英] AM Not able to delete a record

查看:68
本文介绍了AM无法删除记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试了所有..

I have tried all..

Dim daDelActivities As New MySqlDataAdapter

        If (MsgBox("Are you sure you want to delete this Record?", vbOKCancel + MsgBoxStyle.Critical, "Delete Record") = vbOK) Then
            Dim qryDelActivities As String = "DELETE * FROM tbl_activities " _
     & "WHERE tbl_activities.appformno ='" & ActFormNo & "' AND tbl_activities.act_code ='" & ActCodeNo & "'"

            daDelActivities.DeleteCommand = New MySqlCommand(qryDelActivities, conn)
            Dim cb As MySqlCommandBuilder = New MySqlCommandBuilder(daDelActivities)

            MsgBox("Deleted!", vbOKOnly + MsgBoxStyle.Information, "Deleted")

        End If

推荐答案

您应该收到语法错误,因为您没有执行
You should be getting a syntax error because you don''t do
DELETE * FROM 

您只需

DELETE FROM



请从现在开始发布错误消息,或者阅读您收到的错误消息,然后您就会知道.



Please post an error message from now on or read the error message you are getting and then you would know.


是的,谢谢,只是午夜了,我还没有成功.我添加了以下代码,并删除了DELETE * FROM上的Start *,并且成功了
Yes Thank you, its only that its midnight and i had not gotten successful. I added the below code PLUS removed the Start * on DELETE * FROM , and it worked
'Clear all objects from the collection
            daDelActivities.TableMappings.Clear()
            ' Map Table to Contacts.
            daDelActivities.TableMappings.Add("tbl_activities", "appformno")
            ' Fill the DataSet.
            dsDelActivities.Clear()

            daDelActivities.Fill(dsDelActivities, "tbl_activities")
            daDelActivities.DeleteCommand = New MySqlCommand(qryDelActivities, conn)
            daDelActivities.Update(dsDelActivities, "tbl_activities")


这篇关于AM无法删除记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆