如何在radgrid表数据中删除但不在SQL db中删除 [英] How to delete in radgrid table data but dont delete in SQL db

查看:53
本文介绍了如何在radgrid表数据中删除但不在SQL db中删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果e.CommandName =lkdelete那么



GobjDbconn.OpenConn()



MSSql =从vsolv_trn_tpurchase删除,其中purchase_gid ='& e.CommandArgument& '



MnResult = GobjDbconn.ExecuteNonQuerySQL(MSSql)



如果MnResult = 1那么

lblerrmsg.Text =购买数据已成功删除

否则

lblerrmsg.Text =购买数据已删除失败

结束如果



GobjDbconn.CloseConn()



结束如果



< asp:ImageButton ID =btndeleteCausesValidation =falserunat =serverImageUrl =〜/ images / Button_Delete.png

ToolTip =单击以删除OnClientClick =javascript:return confirmDelete();

CommandName =lkdeleteHeight =25pxWidth =25pxCommandArgument ='<%#DataBinder.Eval(Cont ainer.DataItem,purchase_gid)%>'>



我尝试过:



它的正常删除是工作但我试图删除数据形式radgrid只是不受DB数据的影响





帮助解决该问题

If e.CommandName = "lkdelete" Then

GobjDbconn.OpenConn()

MSSql = " Delete from vsolv_trn_tpurchase where purchase_gid='" & e.CommandArgument & "' "

MnResult = GobjDbconn.ExecuteNonQuerySQL(MSSql)

If MnResult = 1 Then
lblerrmsg.Text = " Purchase Data deleled successfully"
Else
lblerrmsg.Text = " Purchase Data deleted failed "
End If

GobjDbconn.CloseConn()

End If

<asp:ImageButton ID="btndelete" CausesValidation="false" runat="server" ImageUrl="~/images/Button_Delete.png"
ToolTip="Click to Delete" OnClientClick="javascript:return confirmDelete();"
CommandName="lkdelete" Height="25px" Width="25px" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "purchase_gid") %>'>

What I have tried:

Its normal delete is work but i hav try to delete data form radgrid only dont its not affected by DB data


help for that problem

推荐答案

您的radGrid绑定到您从数据库表中获取的数据。

如果没有从数据库表中删除数据,你想要清空radGrid然后解除绑定。



解除绑定radGrid将清空网格而不是数据库表。
Your radGrid is bound to the data you are fetching from DB table.
So if without deleting data from DB table, you want to empty radGrid then just unbind it.

Unbinding radGrid will empty the grid but not the DB table.


这篇关于如何在radgrid表数据中删除但不在SQL db中删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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