I'm trying to find the solution to using a stored procedure to return a result into a VB variable. The procedure below appears to compile and runs great using query analyzer but I'm unaware of how to get the result into VB.
' VISUAL BASIC USING AN ADODB.CONNECTION OBJECT
------------------------------------------------------
cnn.Execute "EXEC spPnExists @PN:=" & CStr(Me.txtOldPN) & ", @Cage:=" & CStr(Me.txtOldCage) & ", @Exists:=" _
& lngRecs & " OUTPUT"
' VISUAL BASIC USING AN ADODB.COMMAND OBJECT
------------------------------------------------------
cnn.Execute "EXEC " & return_status = " dbo.spPnExists '" & Me.txtOldPN & "', '" & Me.txtOldCage & "'"
ALTER PROCEDURE spPnExists
(
@PN nvarchar(32),
@Cage nvarchar(7),
@Exists integer OUTPUT
)
AS
IF EXISTS (SELECT * FROM tblPN WHERE PN=@PN And Cage=@Cage)
SET @Exists = 1
ELSE
SET @Exists = 0
RETURN @Exists
Any help would be appreciated greatly.
---------------------
scking@arinc.com
---------------------
' VISUAL BASIC USING AN ADODB.CONNECTION OBJECT
------------------------------------------------------
cnn.Execute "EXEC spPnExists @PN:=" & CStr(Me.txtOldPN) & ", @Cage:=" & CStr(Me.txtOldCage) & ", @Exists:=" _
& lngRecs & " OUTPUT"
' VISUAL BASIC USING AN ADODB.COMMAND OBJECT
------------------------------------------------------
cnn.Execute "EXEC " & return_status = " dbo.spPnExists '" & Me.txtOldPN & "', '" & Me.txtOldCage & "'"
ALTER PROCEDURE spPnExists
(
@PN nvarchar(32),
@Cage nvarchar(7),
@Exists integer OUTPUT
)
AS
IF EXISTS (SELECT * FROM tblPN WHERE PN=@PN And Cage=@Cage)
SET @Exists = 1
ELSE
SET @Exists = 0
RETURN @Exists
Any help would be appreciated greatly.
---------------------
scking@arinc.com
---------------------