Skip to content Skip to sidebar Skip to footer

Passing Uniqueidentifier Parameter To Stored Procedure

I am trying to pass a uniqueidentifier parameter to a stored procedure using the following code: myCommand.Parameters.Add('@BlogID', SqlDbType.UniqueIdentifier).Value = '96d5b379-7

Solution 1:

Try this

myCommand.Parameters.Add("@BlogID", SqlDbType.UniqueIdentifier).Value = newGuid("96d5b379-7e1d-4dac-a6ba-1e50db561b04");

Solution 2:

A unique identifier is a GUID. so it's a different object type to your string.

You need

myCommand.Parameters.Add("@BlogID", SqlDbType.UniqueIdentifier).Value = 
                                        newGuid("96d5b379-7e1d-4dac-a6ba-1e50db561b04");

Post a Comment for "Passing Uniqueidentifier Parameter To Stored Procedure"