472,784 Members | 923 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,784 software developers and data experts.

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
1 9466
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Vinny | last post by:
Can anyone help me with this strange problem please? I have a stored procedure, with a parameter defined as a uniqueidentifier. The procedure does a select with a number of joins, and filters...
4
by: Jacques Wentworth | last post by:
Hi I have the following problem. I have a SQL Server (2000) Stored Proc that with 4 parameter (one being @UnlockKey uniqueidentifier OUTPUT). I run it from Query Analyzer and the @Key parameter...
3
by: Jeffry van de Vuurst | last post by:
Hi, I'm working with Guids as the primary key of some of my tables. In my code, I'm working with those Guids. Now I was wondering what is the best way to work with Guids (in terms of...
3
by: SMG | last post by:
Hi all, I created one table with following structure, and bound the same with a DataGird. But I am not able to see any column which is having 'uniqueidentifier' as datatype. Name ...
2
by: Roy Rodsson via .NET 247 | last post by:
Hi all! I am using a stored procedure in SQL2000 for retrieving fileinformations from a db. the table as an uniqueidentifier for the file information. The stored procedure has a variable...
3
by: dew | last post by:
I have a stored procedure that retrieves the id of a client table, which is a guid To get that id, I have dim clientid as guid = GetClientID("OrgName") The GetClientID returns a string,...
1
by: SealedClassSingleton | last post by:
Hi, When calling a stored procedure on a SQL 2005 DB with the managed SQL ADOprovider I got the following exception: Syntax error converting character string to uniqueidentifier when I use...
5
by: DotNetNewbie | last post by:
Hi, I am developing an application that has to scale and be very efficient, and I am using asp.net membership in my application. I set things up in my Users table (it has extra columns that I...
2
by: bipinskulkarni | last post by:
Hi, i have a field createdby with datatype GUID. In following query ,i encountered with the error "Conversion failed when converting from a character string to uniqueidentifier" select...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.