I am trying to pass a uniqueidentifier parameter to a stored procedure using the following code:
myCommand.Parameters.Add("@BlogID", SqlDbType.UniqueIdentifier).Value = "96d5b379-7e1d-4dac-a6ba-1e50db561b04";
I still get the error message, but cannot convert from string to GUID. Am I passing the value wrong?
try it
myCommand.Parameters.Add("@BlogID", SqlDbType.UniqueIdentifier).Value = new Guid("96d5b379-7e1d-4dac-a6ba-1e50db561b04");
Unique identifier is a GUID . so this is a different type of object for your string.
You need