Another thing I ran into today. I actually ran into it awhile back but since I ran into it again today I’d thought I’d post on it to help anyone who happens to find it.
You have a GridView and a SqlDataSource that takes 1 or more Guids as a Parameter. You use the built in DataSource configuration and it doesn’t give any errors. However, when you actually run it and pass the Guid, you get this error:
“Implicit conversion from data type sql_variant to uniqueidentifier is not allowed. Use the CONVERT function to run this query.”
Inside your source look at your DataSource. The parameter tag will look something like this:
<asp:QueryStringParameter Name=”Customer_IID” QueryStringField=”iid” Type=”Object” />
Change the Type to Empty like this:
<asp:QueryStringParameter Name=”Customer_IID” QueryStringField=”iid” Type=”Empty” />
I have no clue why Visual Studio 2005 thinks a Guid should be an Object and not an Empty, but this will fix your problems.