Solved

c# and GUIDs sqldbtype.uniqueidentifier

Posted on 2008-06-11
3
1,429 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:
anuragal 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

832 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