sql 语句在delphi中实现
我想在delphi中利用ADO组件实现以下的语句,请大虾指点一下。declare @str1 varchar(13),@str2 varchar(13),@i int,@str3 int,@str4 int
DECLARE thing_Cursor CURSOR FOR
SELECT dcardno FROM kcard_items_emptycard where dticketno='0000EC201103260001'
OPEN thing_Cursor
FETCH NEXT FROM thing_Cursor into @str1
WHILE @@FETCH_STATUS = 0
BEGIN
set @i=1
set @str2='8000'+@str1
set @str3=0
set @str4=0
while @i<13
begin
if @i % 2 =0
set @str3=@str3+cast(substring(@str2,@i,1) as int)
else
set @str4=@str4+cast(substring(@str2,@i,1) as int)
set @i=@i+1
end
set @str2=@str2+substring(cast(@str3*7+@str4*9 as varchar(9)),len(cast(@str3*7+@str4*9 as varchar(9))),1)
update kcard_items_emptycard set dcardsbh=@str2 where dcardno=@str1
FETCH NEXT FROM thing_Cursor into @str1
END
CLOSE thing_Cursor
DEALLOCATE thing_Cursor