Hi everyone!
I'm trying to make this SP run:
myDataContext.InsertEvent(codEvent, dateOfEvent, statusOfEvent);
codEvent is an int; dateOfEvent is a DateTime; statusOfEvent is a char.
The problem is Visual Studio is throwing an error if I pass a statusOfEvent null. And, my SP accpts nullable char just like my table.
I've tried to do this too:
char? statusOfEvent= null;
if (!String.IsNullOrEmpty(f["statusOfEvent"]))
statusOfEvent= Convert.ToChar(f["statusOfEvent"]);
But it also throws an error...
thanks!!
I've tried to do this ternary expression:
!String.IsNullOrEmpty(f["statusOfEvent"]) ? Convert.ToChar(f["statusOfEvent"]) : DBNull.Value
But it is says that 'there is no implicit conversion between char and DBNull'
And I also looked at '*.dbml' designer.cs file and my SP method has this line:
[Parameter(DbType="Char(1)")] System.Nullable<char> statusOfEvent