PC Review


Reply
Thread Tools Rate Thread

conversion problem string to GUID

 
 
=?Utf-8?B?U2FuZHk=?=
Guest
Posts: n/a
 
      24th Feb 2004
I am trying to convert a string into a uniqueidentifier by using the following code

Dim contrID = Request.Params("oId"
Dim sqlID As SqlGuid = 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



 
Reply With Quote
 
 
 
 
Lifeng Lu
Guest
Posts: n/a
 
      26th Feb 2004
The problem is the "old" param does not exist, so you get a null contrlID,
which is not acceptable for SqlGuid.Parse.

You need add a few lines code to check whether contrlID IsNull, and handle
that situation correctly.


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
String to Number Conversion Problem Rainer Bielefeld Microsoft Excel Programming 8 22nd Nov 2009 01:49 PM
problem with string conversion CSharp Irfan Microsoft Dot NET 3 5th Dec 2006 06:12 PM
string conversion problem tr.andrus Microsoft Excel Programming 0 19th Sep 2006 11:23 PM
Dumb String Conversion Problem? Fred Hebert Microsoft VC .NET 8 30th Mar 2005 07:41 AM
String conversion problem (encoders) Jon Skeet [C# MVP] Microsoft Dot NET Framework 15 23rd Oct 2003 12:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:12 AM.