I have a procedure that give me results when I run it on EM but it doesn't when I run it on ASP.NET.
CREATE PROCEDURE testproc
(
@ID int,
@TEL int,
@RES int OUTPUT,
@RESD varchar(20) OUTPUT
)
AS
SELECT
a.RES,
a.RESD
FROM vTTM a LEFT OUTER JOIN
(SELECT tab2.id
FROM tab2 INNER JOIN
tab9 ON tab2.id = tab9.t2_id
WHERE tab2.ID=@ID
AND tab2.TEL= @TEL
GROUP BY tab2.id) b ON a.idt = b.id
GO
I wanted to add this to the SELECT:
SELECT
@RES = a.RES,
@RESD = a.RESD
ERROR: A SELECT statement that assigns a value to a variable must not be combined with data-retrieval operations
then I tried to hardcore the results just to see if I could see my values in my ASP.NET application,
SELECT
@RES = 1,
@RESD = 'TEST'
diddn't work, got the same result.
Again, the procedure works fine if I run it via EM
exec testproc 1,22,0,0 that give the the correct results and RES and RESD have the appropiate result values I want.
I am lost, I tried to post this in the ASP.NET forum just in case I had something wrong on my code. Perhaps is my stored procedure... ???? any thoughts?
thanks so much
CREATE PROCEDURE testproc
(
@ID int,
@TEL int,
@RES int OUTPUT,
@RESD varchar(20) OUTPUT
)
AS
SELECT
a.RES,
a.RESD
FROM vTTM a LEFT OUTER JOIN
(SELECT tab2.id
FROM tab2 INNER JOIN
tab9 ON tab2.id = tab9.t2_id
WHERE tab2.ID=@ID
AND tab2.TEL= @TEL
GROUP BY tab2.id) b ON a.idt = b.id
GO
I wanted to add this to the SELECT:
SELECT
@RES = a.RES,
@RESD = a.RESD
ERROR: A SELECT statement that assigns a value to a variable must not be combined with data-retrieval operations
then I tried to hardcore the results just to see if I could see my values in my ASP.NET application,
SELECT
@RES = 1,
@RESD = 'TEST'
diddn't work, got the same result.
Again, the procedure works fine if I run it via EM
exec testproc 1,22,0,0 that give the the correct results and RES and RESD have the appropiate result values I want.
I am lost, I tried to post this in the ASP.NET forum just in case I had something wrong on my code. Perhaps is my stored procedure... ???? any thoughts?
thanks so much