467,892 Members | 1,936 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,892 developers. It's quick & easy.

converting String to uniqueidentifier

I am trying to convert a string into a uniqueidentifier by using the following code

string contrID = Request.Params["oId"
SqlGuid sqlID = SqlGuid.Parse(contrID

I am then putting sqlID into my SQL WHERE clause so it only pulls that record. I've double checked that the record I'm trying to pull is in the database. I am getting the error below. I don't understand what is causing it, Any Help is appreciated!!!!!!

ArgumentNull_String Parameter name: g
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentNullException: ArgumentNull_String Parameter name:

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ArgumentNullException: ArgumentNull_Strin
Parameter name: g
System.Guid..ctor(String g) +341
System.Data.SqlTypes.SqlGuid..ctor(String s) +3
System.Data.SqlTypes.SqlGuid.Parse(String s) +1
Contract_Contact.grid_data.GetDataset(String sortcolumn, ColumnSortDirection sortdirection
Contract_Contact.grid_data.Page_Load(Object sender, EventArgs e
System.Web.UI.Control.OnLoad(EventArgs e) +6
System.Web.UI.Control.LoadRecursive() +3
System.Web.UI.Page.ProcessRequestMain() +73

Nov 15 '05 #1
  • viewed: 9051
Share:
1 Reply
Sandra wrote:
I am trying to convert a string into a uniqueidentifier by using the following code:

string contrID = Request.Params["oId"]
SqlGuid sqlID = SqlGuid.Parse(contrID)

I am then putting sqlID into my SQL WHERE clause so it only pulls that record. I've double checked that the record I'm trying to pull is in the database. I am getting the error below. I don't understand what is causing it, Any Help is appreciated!!!!!!!

ArgumentNull_String Parameter name: g
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentNullException: ArgumentNull_String Parameter name: g

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:
[ArgumentNullException: ArgumentNull_String
Parameter name: g]
System.Guid..ctor(String g) +3415
System.Data.SqlTypes.SqlGuid..ctor(String s) +33
System.Data.SqlTypes.SqlGuid.Parse(String s) +19
Contract_Contact.grid_data.GetDataset(String sortcolumn, ColumnSortDirection sortdirection)
Contract_Contact.grid_data.Page_Load(Object sender, EventArgs e)
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731


It's pretty much what the error message is telling you: contrID is null
- there's no string to parse into a GUID.

Are you sure you have the right params name ("oId")?

Are you sure it's in the request?

--
mikeb
Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Jacques Wentworth | last post: by
3 posts views Thread by Jeffry van de Vuurst | last post: by
3 posts views Thread by SMG | last post: by
1 post views Thread by SealedClassSingleton | last post: by
reply views Thread by MrMoon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.