I have a code:
using (OAZISDBDataContext ctx = new OAZISDBDataContext()) { IEnumerable<DBContactDetail> details = ctx.ExecuteQuery<DBContactDetail>("exec [dbo].[zna_contact] {0}, {1}", "test", "19601023", }
However, I also want to be able to pass empty values ββto the stored procedure so that it just doesn't use them.
Now using strings is easy, I can just pass String.Empty and it will work. However, if I want to pass empty dates, this is a problem.
I obviously tried:
using (OAZISDBDataContext ctx = new OAZISDBDataContext()) { IEnumerable<DBContactDetail> details = ctx.ExecuteQuery<DBContactDetail>("exec [dbo].[zna_contact] {0}, {1}", "test", null, }
But this does not work, gives an error:
System.Exception error: The request parameter cannot be of type System.Object.
After some reading, I found out that ExecuteCommand does not support null parameters, while spec states that it should.
Has anyone encountered this problem and found a workaround?
Thanks a bunch
source share