[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1466
  • 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;
                    cmd.Parameters.Add(parmtid);
how do i set that parameter value as a session?

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

Session['param'] = parmtid;
0
 
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
0
 
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.

Anurag
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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