Frank,
One thing you could do is just add a default value in your stored procedure that will be used in the occurence of no value being passed to the stored procedure. Then the stored procedure will still run even if you do not pass a paramter value for one that has a default
Here is an example:
CREATE PROCEDURE [dbo].[ClientSelectByDynamic]
@ClientNumber int = 0, @ClientName char(20) = ' ', @PolicyNumber char(20) = ' '
AS ...
I have never passed null as a parameter, but you could very easily pass something else (like a blank) and do what you want based on this input.
HTH
>Hi,
>
>I am trying a new technique with stored procedures and I need to pass null values to them in order to make it work.
>
>However, now I am getting an error on this line of code (C#)
>
>
return this.GetEntity("ClientsSelectByDynamic",
>this.CreateParameter("@ClientNumber", clientNumber),
>this.CreateParameter("@ClientName", clientName),
>this.CreateParameter("@PolicyNumber", policyNumber));
>
>The error I get is:
>
>System.Data.SqlClient.SqlException was unhandled by user code
>Message="Procedure or function 'ClientsSelectByDynamic' expects parameter '@ClientName', which was not supplied."
>
>I am guessing CreateParameter does not handle null values. What can I do to get this to work?
>
>I am using VS2008 and MM.NET 3.6