I created a SQL script that takes parameters to return counts. There are three possible parameters: Filter Type, Project ID, and Form Name. Here is the Stored Procedure from SQL Server 2005:
@iProject int = NULL,
@sForm nvarchar(36) = NULL
SET NOCOUNT ON;
-- Select 'ALL' Record(s) in Table
IF @sFilter = 'ALL'
-- Select 'ALL' Record(s) by Project in Table
IF @sFilter = 'PROJECT'
SELECT COUNT(*) AS Expr1
Design_LinkProject = @iProject
-- Select 'ALL' Record(s) by Form in Table
IF @sFilter = 'FORM'
SELECT COUNT(Design_Name) AS Expr1
(Design_LinkProject = @iProject)
AND (Design_FormName = @sForm)
Right now I want to filter of a particular Project ID on 1 and supplied the parameters: @sFilter = "PROJECT", @iProject = 1, @sForm = NULL.
The returned value is 0. I have three records in the table. The field, "Design_LinkProject" shows 1 for all three so I should get a value of 3 returned.
Any ideas please? Thanks!