开发者

Conversion failed when converting from a character string to uniqueidentifier

开发者 https://www.devze.com 2023-03-18 17:48 出处:网络
I started getting this error in ASP.NET Gridview SQLDat开发者_运维知识库aSource. Everything was fine. In the Edit Column, Gridview I accediently added the same colum (ID) twice but then I removed it.

I started getting this error in ASP.NET Gridview SQLDat开发者_运维知识库aSource. Everything was fine. In the Edit Column, Gridview I accediently added the same colum (ID) twice but then I removed it. I started getting this error. I am not passing anything anywhere. It is a simple select statement which joins the two tables.

SELECT T1.[ID], T1.[amg_id], T1.[FirstName], T1.[LastName],  
T2.[UserName] FROM [T1] JOIN T2
on T1.ApplicationUserID = T2.UserID

I could not figure how where I am getting this error. Then I copied my SQL statement from SQLDatasource to SQL Server Management Studio. Surprisingly I got the same error. If I split the join and pull the records individually, both queries work fine. Don't know where is the problem and how it got started. The same query ran fine before.I hope to reply to this question, once I find the solution. SQL Error is here:

Msg 8169, Level 16, State 2, Line 1 Conversion failed when converting from a character string to uniqueidentifier.


I have only one idea about this issue - the types of T1.ApplicationUserID and T2.UserID are different ... I think that this flash appears because of error you've mentioned. Please check the data types, what are they?

0

精彩评论

暂无评论...
验证码 换一张
取 消