Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Asp.Net Conversion failed when converting from a character string to uniqueidentifier.

Avatar of westdh
westdhFlag for United States of America asked on
.NET ProgrammingASP.NET
7 Comments1 Solution398 ViewsLast Modified:
this is my string:
            SelectCommand="SELECT '' as UserId, '' as [Company], '' as [WebSiteUrl] UNION SELECT UserId, Company, WebSiteUrl FROM [UserProfile] ORDER BY [Company]">

this is my error:
--------------------------------------------------------------------------------

Conversion failed when converting from a character string to uniqueidentifier.
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.Data.SqlClient.SqlException: Conversion failed when converting from a character string to uniqueidentifier.
----------------------------------------------------------------------------------

this portion of my code:  can be: '' as UserId or '0' as UserId that for a string or a int
I do not know what it would take to convert the Guid to a string as to replace '' as UserId.

ASKER CERTIFIED SOLUTION
Avatar of Reza Rad
Reza RadFlag of New Zealand imageConsultant, Trainer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 7 Comments.
See Answers