Problem with GUID's

  • Thread starter Thread starter PatLaf
  • Start date Start date
P

PatLaf

Hello all,
I have an application that reads guids from sql server
and stores them as the value in a drop down list. Once
they are stored as strings I can't figure out how to get
it back to a guid type for the sql server's sproc. I keep
getting an invalid cast from string.....type string
cannot be converted to guid. The problem is that I need
the string converted back to guid so that I can qry the
db using the guid. Any ideas would be greatly appreciated.


Thanks in advance
Pat
 
Try something like this:
cmdPhtgUpd.Parameters.Add(New System.Data.SqlClient.SqlParameter("@PaymentMethods", System.Data.SqlDbType.UniqueIdentifier, 254, "PaymentMethods"))
 
Pat,

Try using the GUID constructor

Dim g As System.Guid
g = New System.Guid(stringGUID)

Kathleen
 
Hi PatLaf,

When you're binding a drop down list to a Guid column, you needn't convert
it to string. Just set the data source and data member, the Guid will be
converted to string automatically.

If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top