If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > SQL SERVER STORED PROCEDURE stopped wehn called from ASP code

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-08-03, 10:48
manish75006 manish75006 is offline
Registered User
 
Join Date: Oct 2003
Posts: 2
SQL SERVER STORED PROCEDURE stopped wehn called from ASP code

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

%>
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On