如何使用存储过程更新Gridview中的记录? [英] how do i update record in Gridview with store procedure?

查看:69
本文介绍了如何使用存储过程更新Gridview中的记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用存储过程更新Gridview中的记录

how do i update record in Gridview with store procedure

推荐答案

您不知道.您在数据库中对其进行更新,然后从数据源刷新gridview.每天询问5次.如何在C#中调用存储的proc的信息在网络上已有广泛记载.
You don''t. You update it in your database, then you refresh your gridview from the data source. This is asked 5 times a day. How to call a stored proc in C# is widely documented on the web.


您可以在gridview中使用链接按钮,并设置其 commandname ="update"
commandargument(唯一的ID)



例如:-



you can use the linkbutton inside gridview and by setting its commandname="update" and
commandargument (which is the unique id)



for e.g:-



<itemtemplate><br />
    <asp:linkbutton id="lbtnupdate" runat="server" commandname="update"<br />
   commandargument=''<%#Eval(UniqueId")%>'' text="Update"/><br />
</itemtemplate><br />




并在编码中-

触发行命令事件

在里面





and in the coding--

fire the row command event

and inside it


if(e.commandname=="update")
{
//get the commandargument for which linkbutton is clicked
property.UniqueId=convert.toint32(e.commandargument);
}



触发gridview的rowupdating事件

并且在这种情况下,更新数据库中该 UniqueId
的记录
然后更新重新绑定网格视图..

它将显示所有更新的记录..


希望它能对您有帮助!


问候:)

理查兹...



fire the rowupdating event of the gridview

and in this event update the records in the database for that UniqueId

and after updating Rebind the gridview..

it will show all updated records..


hope it wud help you!!


regards :)

richards...


这篇关于如何使用存储过程更新Gridview中的记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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