Invalid cast from System.String to System.Guid error only happening sometimes

H

hotsdogs2003

I am getting the Invalid cast from System.String to System.Guid error
passing a guid to an SP in C#. I know how to fix it by passing the
string guid to a new Guid() but what I am wondering is why the error is
only happening on one of our servers and not all of them. We have four
other servers that had no problem taking the guid as a string and
converting it to a Guid implicitly but one server did not have the
problem. We have the same version of ADO, .Net framework and OS,
windows 2003 on all the servers. Is it some MS patch or something else
we are missing? It might not seem important but it took a couple of
days to track down the problem since the problem could not be
reproduced consistently. That is kind of irritating.
 
G

Guest

I can't tell exactly what you are doing but I know that the value returned by
the SQL Client for a GUID data value does not have a "toString()" so in order
to get the string value of it you have to assign it (or cast it) to a
System.Guid and then use its toString().
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top