In my application, I wanted to be able to pass a NULL value to these sprocs. I changed the code generator where clause generation to:
// Create the where clause for (int i = 0; i < compositeKeyList.Count; i++) { Column column = (Column) compositeKeyList[i]; if (i > 0) { writer.WriteLine("\tAND "); } else { writer.WriteLine("\t"); } writer.WriteLine("(COALESCE([" + column.Name + "], @" + column.ProgrammaticAlias + ") IS NULL " + "OR [" + column.Name + "] = @" + column.ProgrammaticAlias + ")"); }
This gives me both the new and the original functionality.
David
Log in to post a comment.
In my application, I wanted to be able to pass a NULL value to these sprocs. I changed the code generator where clause generation to:
// Create the where clause
for (int i = 0; i < compositeKeyList.Count; i++) {
Column column = (Column) compositeKeyList[i];
if (i > 0)
{
writer.WriteLine("\tAND ");
}
else
{
writer.WriteLine("\t");
}
writer.WriteLine("(COALESCE([" + column.Name + "], @" + column.ProgrammaticAlias + ") IS NULL " +
"OR [" + column.Name + "] = @" + column.ProgrammaticAlias + ")");
}
This gives me both the new and the original functionality.
David