I'm tying to accomplish a very basic result which is to count the number of rows in a stored procedure using WebMatrix.Data. Since I'm new to creating stored procedures and using WebMatrix.Data I would appreciate it if someone could lead me to the best practice path.
Here is what I've done so far:
CREATE PROCEDURE [dbo].[SD_photoCount]
@IDuser nvarchar (150)
AS SET NOCOUNT OFF;
SELECT Count(photos.IDphoto) AS photoCount FROM photos WHERE IDuser = @IDuser
[WebMethod]
public static string photoCount(string IDuserInput)
{
var photoCount_query = db.Query("Exec dbo.SD_photoCount @0", IDuserInput);
var photoCountResult = photoCount_query.photoCount;//ERROR
return photoCountResult.ToString();
}
The error I'm getting is the following:
Error 4 'System.Collections.Generic.IEnumerable' does not contain a definition for 'photoCount' and no extension method 'photoCount' accepting a first argument of type 'System.Collections.Generic.IEnumerable' could be found (are you missing a using directive or an assembly reference?)