Results 1 to 3 of 3

Thread: passing a GUID in the querystring

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Posts
    4

    Question passing a GUID in the querystring

    I need to pass a GUID into a page via the QueryString. If I do:

    VB Code:
    1. Dim myGUID as GUID
    2. GUID = Request.QueryString("myGUID")

    It won't run, and says that a value type of string cannot be converted to a GUID. I can't retype myGUID as a string, because I use it in a SQL Server Database call....It yells at me if try to do a query with it in there.

    Am I doing something wrong? or is there just no way to pass a GUID through the querystring?

    Thanks

  2. #2
    New Member
    Join Date
    Mar 2003
    Posts
    9
    If you pass the value on the url it will be in a string format. The following worked for me. Maybe this will help.

    select * from table1 where uniqueID = cast('{5BEEAA61-394B-44F6-9AC8-A6EA5FC99490}' as uniqueidentifier)
    Brad

  3. #3
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    You need to do the following:

    Code:
    Dim MyGuid As Guid = New Guid(Request.QueryString("myGuid"))

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width