事件触发时行上的工作操作

编程入门 行业动态 更新时间:2024-10-26 22:25:09
本文介绍了事件触发时行上的工作操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的asp页上有一个网格,网格上有一个删除链接,通过该链接我从网格中删除一行,从而使数据库具有网格的rowdelete事件,并使用一个ID作为唯一列,并以此列为基础.现在,这个独特的列就像uq00001/1及其varchar.我希望当我从网格中删除一行时,例如网格有5行,而我正在删除第三行,因此在数据库中,唯一ID就像uq0001/1,uq0002/2,uq0003/3.网格,然后将行从数据库中删除,并将其他ID填充后的其他ID.例如.当删除第三行时,第4行将变为uq0003,第5行将变为uq004 ..同样明智的做法是,在网格中添加行时也必须增加.但是删除是我被困在的地方. 我想通过数据库做到这一点.我曾尝试在存储过程中使用游标,但无法正常工作.

I have a a grid on my asp page and grid has a delete link by which i delete a row from grid so as database with rowdelete event of grid using one id as uniquecolumn and rows on the basis of this column. now this unique colum is like uq00001/1 and its varchar. i want that when i delete one row from grid for example grid has 5 rows and i am deleting 3rd row so in database the unique id ll be like uq0001/1,uq0002/2,uq0003/3.. nowif i delete third row from grid then the row ll ve deleted from database and the other ids after these ll be adgested. eg. when thrid row is deleted then the 4rth row ll become uq0003 and 5th ll become uq004.. like wise i have to do to increment also when add row in grid. but deletion is where i am stucked in . and i want to do this through database. i have tried cursor inside a stored procedure but its not working.

推荐答案

declare @repid varchar(20) declare @rows int set @repid=(select distinct receiptid from tempdepositslipdtls where custreceiptno='') set @rows=(select count(custreceiptno)from tempdepositslipdtls where receiptid=@repid) declare @f varchar(30) declare @g int set @f=@repid set @g=convert(int,(select (substring(custreceiptno,12,4)-1)from tempdepositslipdtls where custreceiptno='')) declare @counter int set @counter=0 while(@counter<=@rows) begin update tempdepositslipdtls set custreceiptno=@f+@g where custreceiptno=@custreceiptno; set @counter=@counter +1 ..now here receiptid is the id which has three more uniqueid ie custreceiptno for example ReceiptID - custreceiptno/1 custreceiptno/2 custreceiptno/3 this code was without cursor.. and have one more code with cursor that is also not working but i want to code without cursor.

更多推荐

事件触发时行上的工作操作

本文发布于:2023-07-31 15:38:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1259985.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:时行   事件   操作   工作

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!