Stored Procedure "failing"

L

Luis

I'm using a SQL Server 2000 stored procedure similar to the one below
to upload data to a database. This data is collected from the user on
a number of asp pages and stored in session variables (that's the way
I inherited the system...). When the user has captured all the info
and clicks the submit button the stored procedure is called and it
uploads the data to the database.

This normally works perfectly except for a few occassions when the
stored procedure has "failed" while loading the data onto the last
table (TestTable3) - the data in the session variables is not loaded
onto the database and the respective fields on the respective tables
are blank.

The most recent time it happened the user was using IE6.0 on Windows
XP.

Why is the stored procedure failing to complete?

The system uses code similar to the following to pass the information
that the user has captured to the stored procedure:


<!--#include file='dbConnect.inc'-->
<%
sqlstring = "EXEC dbo.InsertData @Test1 = '" & session("Test1") & "',
@Test2 = '" & session("Test2") & "', @Test3 = '" & session("Test3") &
"', " &_
"@Data1 = '" & session("TestData1") & "', @Data2 = '" &
session("TestData2") & "', @Data3 = '" & session("TestData3") & "', "
&_
"@SomeData1 = '" & session("Test1") & "', @SomeData2 = '" &
session("Test2") & "', @SomeData3 = '" & session("Test3") & "', "'"

conn.execute(sqlstring)
conn.close
Set conn = nothing
%>

The stored procedure is similar to:

CREATE PROCEDURE dbo.InsertData

@Test1 NVARCHAR(10),
@Test2 NVARCHAR(10),
@Test3 NVARCHAR(10),

@Data1 NVARCHAR(50),
@Data2 NVARCHAR(50),
@Data3 NVARCHAR(50),

@SomeData1 NVARCHAR(10),
@SomeData2 NVARCHAR(10),
@SomeData3 NVARCHAR(10),

AS
BEGIN

SET NOCOUNT ON
DECLARE @ID INT

INSERT TestTable1
(Field1,Field2,Field3)
VALUES
(@Test1,@Test12,@Test3)

SELECT @ID = SCOPE_IDENTITY()
SELECT ID = @ID

INSERT TestTable2
(ID,FieldAA,FieldBB,FieldCC)
VALUES
(@ID,@Data1,@Data2,@Data3)

INSERT TestTable3
(ID,FieldX1,FieldX2,FieldX3)
VALUES
(@ID,@SomeData1,@SomeData2,@SomeData3)

END
GO
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top