本文介绍了使用游标从数据网格中删除多个记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们......

任何人都可以帮我解决这个问题....

我想删除数据网格中的多条记录cursors.the存储过程的参数是一个逗号分隔的字符串(User_ID),但我写的存储过程不起作用,任何人都可以帮助我,这对我来说是一个很大的帮助。当我执行程序和打印@@ FETCH_STATUS它打印的状态-1即没有记录....


CREATE PROCEDURE test_cur3(@User_ID varchar(100))

as


设置NOCOUNT


声明@UID字符(15)

DECLARE TESTCUR3 CURSOR

SELECT User_ID FROM Header WHERE User_ID in(@User_ID)


open TESTCUR3


FETCH NEXT FROM TESTCUR3

INTO @UID

WHILE @@ FETCH_STATUS = 0

BEGIN



update标题集已删除=' '1''WHERE User_ID = @UID


下一个来自TESTCUR3

INTO @UID

结束;


关闭TESTCUR3

DEALLOCATE TESTCUR3

GO

Hi Friends...
Can anyone plz help me out i''m stuck ....
I want to delete multiple records from a data grid using cursors.the parameter for the stored procedure is an comma seperated string(of User_ID),but the stored procedure which i had written is not working can anyone help me out,it would be a great help for me.when i execute the procedure and print @@FETCH_STATUS the status it prints -1 ie no record ....

CREATE PROCEDURE test_cur3(@User_ID varchar(100))
as

SET NOCOUNT ON

declare @UID char(15)
DECLARE TESTCUR3 CURSOR for
SELECT User_ID FROM Header WHERE User_ID in ( @User_ID)

open TESTCUR3

FETCH NEXT FROM TESTCUR3
INTO @UID
WHILE @@FETCH_STATUS = 0
BEGIN


update Header set Deleted=''1'' WHERE User_ID= @UID


FETCH NEXT FROM TESTCUR3
INTO @UID
END;

CLOSE TESTCUR3
DEALLOCATE TESTCUR3
GO

推荐答案





您是否尝试过传递一个值?


检查是否有效并发回POST。如果程序使用单个值,那么我们可以找出问题是通过多个值传递还是程序本身。

Have you tried by passing a single value?

Check if that is working and POST back. If the procedure is working with single value then we could trace out if the problem is with multiple value being passed or with the procedure itself.


这篇关于使用游标从数据网格中删除多个记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-21 09:36