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...

Advertisement
Free Agile Project Management Tool from Telerik
TeamPulse Community Edition helps your team effectively capture requirements, manage project plans, assign and track work, and most importantly, be continually connected with each other.
Category: SQL | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 2582 | Hits: 249

Similar Posts

  • VS 2010 Code Intellisense Improvements (VS 2010 and .NET 4.0 Series) more
  • Lower Case URLs and ASP.NET MVC more
  • Unit Testing - Do Repeat Yourself more
  • Fun With Method Missing and C# 4 more
  • Four Little Known, Helpful Methods, Properties, and Features for ASP.NET Developers more
  • Generic Types and Inheritance more
  • Exception Handling Advice for ASP.NET Web Applications more
  • Improved type safety when dealing with generic types, generic methods and reflection more
  • WebResource access in ASP.NET MVC more
  • Using Microsoft's Chart Controls In An ASP.NET Application: Plotting Chart Data more

News Categories

.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD