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.
Problem
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.”
Solution
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.
Related Posts
- ASP .NET 2.0, GridViews, HyperLinkField, and JavaScript I’ve found some interesting notes on ASP .NET’s GridView, it’s limitations and work arounds. For work I was looking for a way to execute JavaScript from clicking a link on a GridView Cell. An example would be to having a list of transactions and wanting to click a link to...
- ASP .NET GridView Access to Data In Code There are situations where you want to gain access to the GridView’s DataSet to display extra information outside of the GridView. I found the following code to work the best for me. You can get the information from the DataSource of a GridView by doing the following: DataView dv =...
- PHP5.x or PHP6 – Argument for Type-Hinting: Better IDEs I’ve read some posting lately about PHP6, the Meeting Notes by the Developers, etc. that deal with type-hinting, especially scalar type hinting. Here is my reasoning why PHP should allow for more type-hinting scenarios: it allows IDEs to be more powerful. An example would be auto completion. Many times an...
awsom! Thank you
This did the trick. I’ve been working on this all night.
Thanks for this. Spot on.
This is still a bug in VS2010 (using Microsoft Visual Web Developer 2010 Express).