I searched the entire network. I wonder why this simple task is so hard to do in C #.
sqlcmd.Parameters.Add("@someid", System.Data.SqlDbType.UniqueIdentifier).Value =
string.IsNullOrEmpty(class.someid) ? System.Data.SqlTypes.SqlGuid.Null : new Guid(class.someid);
This returns an error:
Failed to convert parameter value from string to guid
My stored procedure updates an entry in a table with parameters passed using C #.
What I want to do is update the record and its specific column with a null value using a stored procedure that passes a parameter guidfrom C # c guid, which can sometimes be null. Is this possible in C #?
source
share