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, LINQ, GridViews, and GUID Errors I found a simple problem today. Here is the deal, there were several times where I had to base a LinqDataSource off a Guid that I would set in the Page_Load(). I created an<asp:HiddenField /> to hold the value so all my DataSources could pull it from the control. The...
- 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 =...
- SoapUI - a simple and raw Java SOAP Client There are times when you need a "raw" SOAP client to see the exact messages being sent to and from a Soap Sever. This is especially important for developers who are hosting a soap server for an API. In my example, PHP was throwing an error, but I couldn't see...

Recent Comments