NewsBot
1
OK, next step.* I've now got a strongly typed DataContext which I've associated with a stored procedure in my SQL Server 2005 database.* This SP does allow for nulls to be passed in for various parameters; in fact passing in nulls for some of the parameters will result in more data being returned, which is exactly what I want.* However, I don't know how to pass in nulls for the parameters of the method that is my SP associated with the LINQ to SQL result class.* I'll do something like the following to declare variables to pass to the method of the result class:
string firstName, lastName, socialSecurityNo;
DateTime? dateOfBirth;
firstName = "Fred";
lastName = "Flintstone";
MyStronglyTypedDataContext dc = new MyStronglyTypedDataContext();
System.Data.LINQ.ISingleResult result = dc.spCheckData(firstName, lastName, socialSecurityNo, dateOfBirth);
As you can see, I've left the socialSecurityNo and dateOfBirth values alone, which will mean that socialSecurityNo will likely equal string.Empty and dateOfBirth will be null.* These are allowed for in the SP, but running this results in nothing being returned.* I know this is not true, because if I run the same query in SSMS I get results.* So, how do I assign values to those variables so that when the call to spCheckData() occurs it will pass in null values to the SP?
More...
View All Our Microsoft Related Feeds
string firstName, lastName, socialSecurityNo;
DateTime? dateOfBirth;
firstName = "Fred";
lastName = "Flintstone";
MyStronglyTypedDataContext dc = new MyStronglyTypedDataContext();
System.Data.LINQ.ISingleResult result = dc.spCheckData(firstName, lastName, socialSecurityNo, dateOfBirth);
As you can see, I've left the socialSecurityNo and dateOfBirth values alone, which will mean that socialSecurityNo will likely equal string.Empty and dateOfBirth will be null.* These are allowed for in the SP, but running this results in nothing being returned.* I know this is not true, because if I run the same query in SSMS I get results.* So, how do I assign values to those variables so that when the call to spCheckData() occurs it will pass in null values to the SP?
More...
View All Our Microsoft Related Feeds