• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1480
  • Last Modified:

c# and GUIDs sqldbtype.uniqueidentifier

im using a guid which im returning from a stored procedure as a parameter and am trying to set the guid as a session variable. So:  

  SqlParameter parmtid = new SqlParameter();
                    parmtid.ParameterName = "@theaterID";
                    parmtidSqlDbType = SqlDbType.UniqueIdentifier;
                    parmtid.Direction = ParameterDirection.Output;
how do i set that parameter value as a session?

thanks for help!
1 Solution
Rob SiklosCommented:
What happens if you try something like

Session['param'] = parmtid;
ej1111Author Commented:
I get a lot of cannot convert type string to system.guid type messages. quick change of thoughts, im actually trying set that as a guid value; so we have a class with:

static public guid tid and i want to set tid
Anurag AgarwalPython DeveloperCommented:
this error comes when you are trying to convert an empty string into a GUID datatype.

So put a check for String.IsNullOrEmpty() on the statement where you are trying to assign this output param value into session var.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now