Solved

c# and GUIDs sqldbtype.uniqueidentifier

Posted on 2008-06-11
3
1,434 Views
Last Modified: 2008-06-12
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
Comment
Question by:ej1111
3 Comments
 
LVL 9

Expert Comment

by:Rob Siklos
ID: 21765619
What happens if you try something like

Session['param'] = parmtid;
0
 

Author Comment

by:ej1111
ID: 21765729
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
 
LVL 11

Accepted Solution

by:
Anurag Agarwal earned 100 total points
ID: 21766025
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that undeā€¦
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question