Monday, March 19, 2012

Another Stored procedure problem with VB 2005

Solving one problem leads to another. This post is related to my last one (Can't see stored proc results) so this will look familiar to some of you. This sproc is called by a VB front end. It retrieves a name based on an ID#:

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

ALTER PROCEDURE [dbo].[usp_CrimRecTest]
-- Add the parameters for the stored procedure here
@.caseID nvarchar(12)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT dbo.tblCASENOMASTER.CASENO, dbo.tblCASEMAST.LASTNAME, dbo.tblCASEMAST.FRSTNAME
FROM dbo.tblCASENOMASTER LEFT OUTER JOIN
dbo.tblCASEMAST ON dbo.tblCASENOMASTER.CASENO = dbo.tblCASEMAST.CASENO
WHERE (dbo.tblCASENOMASTER.CASENO = @.caseID)
END

I am also looking for problems on the VB side if it's not here.

It executes fine on the SQL Server side. I took an option to preview the data through the VB dataset that this sproc fills. After entering the required parm, instead of the name I want, I see this:
Type Value
Int32 0
I previewed a view with the same select statement minus the WHERE clause. It worked fine. Any reason why the sproc shows up differently?
Thank you for all of the help.

If it executes fine in the SQL Server side (and you see results?) then there's nothing wrong with the proc. You have to look at the VB side. Does the VB code take care of the returned resultset as it should?

/Kenneth

|||I have been looking into that. Being new to both SQL Server and VB, it takes me a while to find where the real problem is at times. I have determined that the parm is not getting to the sproc correctly. I also found that the VB program is receiving a return value instead of the data set for both of the sprocs I have.|||

I found a way around this on the VB side. Some built in functions are now giving me the results I need.

Thanks for the reply, Kenneth.

No comments:

Post a Comment