L
Loren Dummer
I am converting some VB6 code using ADO to VB.NET using ADO.NET.
I am using the sqlcommand object trying to pass a value to a stored
procedure where one of the parameters is a uniqueidentifier datatype.
I keep getting the following error message from .Net. "Invalid cast from
System.String to System.Guid."
Can anyone tell me what datatype I am suppose to use in .NET for this to
work. I have tried specifying a size also used nvarchar, varchar also with
the same error.
When using VB6 all I had to do was specify the parameter datatype as
advarchar and set the length to a number of characters and everything was
OK.
Here is a sample of my code where I am setting the parameter value.
sqlParam = new sqlParameter
With sqlParam
.ParameterName = "@SessionGUID"
.Direction = ParameterDirection.Input
.SQLDbType = SqlDbType.UniqueIdentifier
.Value = sessionguid
End With
..Parameters.Add(SqlParam)
Any help would be appreciated.
Thanks,
Loren
I am using the sqlcommand object trying to pass a value to a stored
procedure where one of the parameters is a uniqueidentifier datatype.
I keep getting the following error message from .Net. "Invalid cast from
System.String to System.Guid."
Can anyone tell me what datatype I am suppose to use in .NET for this to
work. I have tried specifying a size also used nvarchar, varchar also with
the same error.
When using VB6 all I had to do was specify the parameter datatype as
advarchar and set the length to a number of characters and everything was
OK.
Here is a sample of my code where I am setting the parameter value.
sqlParam = new sqlParameter
With sqlParam
.ParameterName = "@SessionGUID"
.Direction = ParameterDirection.Input
.SQLDbType = SqlDbType.UniqueIdentifier
.Value = sessionguid
End With
..Parameters.Add(SqlParam)
Any help would be appreciated.
Thanks,
Loren