Generic ExecuteScalar method
Posted by: <Rolog>,
on 28 Jan 2007 |
View original | Bookmarked: 0 time(s)
Just wanted to share with everyone the generic helper method I use for ExecuteScalar. A helper method for ExecuteScalar is the perfect candidate for generics due to the different types that could be returned. Of course, you could always return an object, but this is more fun. :)
public static T ExecuteScalar<T>(string commandText, string connectionString)
{
return...