Geeks With Blogs

The Wrecking Bawl Destructuring query language, one keyword at a time.
I just discovered something rather surprising.  If you return a tinyint from a stored procedure as part of a dataset, and bind that dataset to a dataview, and then do something like this:

<asp:Label runat="server" id="statusLabel" Text='<%# GetStatusText( (int)DataBinder.Eval(Container, "DataItem.status")) %>'>

You will get an error about an invalid cast.  If the stored procedure returns an int instead of tinyint, it works just fine.  How can ASP.Net 3.5 not be able to cast from a tinyint (or whatever its C# equivalent is) to an int?? Posted on Tuesday, February 10, 2009 1:05 PM all tech stuff , C# , SQL Server , general .Net stuff | Back to top

Comments on this post: tinyint surprise

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Alex Bransky | Powered by: