Skip to main content
Amaël BERTEAU

Main navigation

  • Home
  • News
  • Software Engineering
  • Entrepreneuriat
  • Maker
  • Misc
  • Personal Projects
  • About me
    • Bio
    • Curriculum Vitae
    • Skills
    • Likes
    • My Values
    • Quotes
    • Favorite Books
    • Favorite Tools
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Software Engineering

Extension methods around DataRecord (DbNull and column name support)

By aberteau , 26 July, 2017

Extension methods around DataRecord (DbNull and column name support)

IDataRecord Interface

namespace : System.Data

Provides access to the column values within each row for a DataReader, and is implemented by .NET Framework data providers that access relational databases.

2 observations :

  • methods take colum index as parameter. (GetInt32(Int32), GetInt64(Int32), ...)
  • we must check if the specified field is set to null before retrieve value (dataRecord.IsDBNull(colIndex) ou dataRecord[columnName] == DBNull.Value)

Needs

  • methods that provide access to the column value by name (GetInt32(String), GetInt64(String), ...)
  • Nullable type to handle DbNull

DataRecordExtensions

Tags

  • SqlClient
  • .Net

Comments

RSS feed
Powered by Drupal