Solved

c# and GUIDs sqldbtype.uniqueidentifier

Posted on 2008-06-11
3
1,423 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
Comment Utility
What happens if you try something like

Session['param'] = parmtid;
0
 

Author Comment

by:ej1111
Comment Utility
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:
anuragal earned 100 total points
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now