Using ExecuteScalar on ,Net Framework 1.1

L

Leeor Chernov

I am using ExecuteScalar, executing a stored procedure with two commands:
the first command is Select command,
and the second is Insert.
Because of the Select command , The ExecuteScalar do not return an error in case of the Insert(second command -see the stored pro. sample in the bottom) failure.

the stored procedure:
CREATE PROCEDURE dbo.usp_UpdateOnline
@Id as bigint,
@source_file as nvarchar(50),

AS
declare @IsUpdate as int
EXEC @IsUpdate = mysp_IsIDExist @Id
SELECT @IsUpdate

--From this point no error is returned to Execue Scalar
INSERT
INTO online.dbo.T_all
(Id,
source_file ,
)

VALUES
( @Id
,@source_file
)

GO

please help

Leeor
 
W

W.G. Ryan [MVP]

Leeor:

You need to Select the value - you are simply inserting, no? There's no query indicating which value to grab. Run another query our use an output parameter and that should do itfor you.
I am using ExecuteScalar, executing a stored procedure with two commands:
the first command is Select command,
and the second is Insert.
Because of the Select command , The ExecuteScalar do not return an error in case of the Insert(second command -see the stored pro. sample in the bottom) failure.

the stored procedure:
CREATE PROCEDURE dbo.usp_UpdateOnline
@Id as bigint,
@source_file as nvarchar(50),

AS
declare @IsUpdate as int
EXEC @IsUpdate = mysp_IsIDExist @Id
SELECT @IsUpdate

--From this point no error is returned to Execue Scalar
INSERT
INTO online.dbo.T_all
(Id,
source_file ,
)

VALUES
( @Id
,@source_file
)

GO

please help

Leeor
 
C

Cor Ligthert [MVP]

Bill,

Is there any reason that you sent to this newsgroup in HTML, please use the
standard textmode. I see not any reason why I should install Hebreic for
your message.

Cor
 

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

Top