I'm reading a data from table A and updating or inserting table B from A
The procedure runs fine fromm query analyser in sql server 7.0 but when i call the same procedure from ASP code it inserts up to 49 records in table B then procedure stops

Please suggest: Here is the code

CREATE Procedure proc_items2
As

Declare



@itemid varchar(20),
@mfg varchar(30),
@mfgno varchar(200),
@cat varchar(100),
@desc varchar(500),
@listprice decimal(10,2),
@condition char(5),
@qty varchar(20)






Declare Cur_i Cursor
For Select ditemcode,ditemcat,ditemmfg,ditemmfgno,ditemdesc,d
itemqty,ditemlistprice,ditemcondition
from ditemtemp

Open Cur_i

Fetch Cur_i
Into @itemid,@cat,@mfg,@mfgno,@desc,@qty,@listprice,@co
ndition



While @@Fetch_Status = 0
Begin

Select ditemcode From ditem WHERE ditemcode = @itemid


IF @@ROWCOUNT=0
begin

insert into ditem(ditemcode,ditemcat,ditemmfg,ditemmfgno,ditem
desc,ditemqty,ditemlistprice,ditemcondition)
values(@itemid,@cat,@mfg,@mfgno,@desc,@qty,@listpr
ice,@condition)

end

Else

begin
update ditem set ditemcat=@cat,ditemmfg=@mfg,ditemmfgno=@mfgno,dite
mdesc=@desc,
ditemqty=@qty,ditemlistprice=@listprice,ditemcondi
tion=@condition where ditemcode=@itemid

end



Fetch Cur_i
Into @itemid,@cat,@mfg,@mfgno,@desc,@qty,@listprice,@co
ndition

End


Close Cur_i
Deallocate Cur_i

THIS IS ASP CODE:
<!-- #include file="adovbs.inc" -->
<%
Dim oConn
Set oConn=Server.CreateObject("ADODB.Connection")
oConn.Open Application("conn")
dim strPath
strPath = Server.MapPath("csv.csv")
Dim strSQL
strSQL = "truncate table ditemtemp"
oConn.Execute(strSQL)


Set CMD = Server.CreateObject( "ADODB.Command" )
CMD.ActiveConnection = oConn
CMD.CommandType = adCmdStoredProc
CMD.CommandText = "ps_items_Import1"
CMD.Parameters.append CMD.CreateParameter("pathFileName",adVarchar,adPar amInput,100)
CMD.Parameters("pathFileName") = strPath

CMD.Execute

CMD.ActiveConnection = Nothing
SET CMD = Nothing

Set CMD1 = Server.CreateObject( "ADODB.Command" )
CMD1.ActiveConnection = oConn
CMD1.CommandType = adCmdStoredProc
CMD1.CommandText = "proc_items2"
CMD1.Execute
CMD1.ActiveConnection = Nothing
SET CMD1 = Nothing

%>