I have a really simple stored procedure that looks like this:
CREATE PROCEDURE _Visitor_GetVisitorIDByVisitorGUID
(
@VisitorGUID AS UNIQUEIDENTIFIER
)
AS
DECLARE @VisitorID AS bigint
SELECT @VisitorID = VisitorID FROM dbo.Visitor WHERE VisitorGUID = @VisitorGUID
--Here's what I've tried
RETURN @VisitorID 'Returns an IDataReader
SELECT @VisitorID 'Returns an IDataReader
--I've also set it up with a single output
--parameter, but that means I need to pass
--the long in by ref and that's hideous to me
I'm trying to get nettiers to generate a method with this signature:
public long VisitorService.GetVisitorIDByVisitorGUID(GUID visitorGUID);
Basically I want Nettiers to call ExecuteScalar instead of ExecuteReader. What am I doing wrong?
Why not use the custom data access functionality to call your stored proc with ExecuteScalar? (http://nettiers.com/DataLayer.ashx#Read_Methods:_4)
var vistorId = (long)DataRepository.Provider.ExecuteScalar(CommandType.StoredProcedure, "_Visitor_GetVisitorIDByVisitorGUID");
The body of the stored proc should look like:
Select VisitorID
FROM dbo.Visitor
WHERE VisitorGUID = @VisitorGUID
Return
or
Declare @VisitorId bigint
Set @VisitorId = (
Select VisitorId
From dbo.Visitor
Where VisitorGuid = @VisitorGUID
)
Select @VisitorId
Return