DataRow dr;
object dataCol_1 = dr[ 0 ];
object dataCol_2 = dr[ 1 ];
ใช้ indexer ระบุคอลัมน์ Index ที่ต้องการครับ แล้วมันจะคืนค่าเป็น Object เสร็จแล้วค่อย cast type ตามชนิดของตัวเอง แต่ต้องระวังว่าค่าที่ได้อาจจะเป็นค่า null (DBNull.Value) เช่น
string strCol_1 = Convert.ToString( dataCol_1 ); //ตรงนี้ไม่ต้องเช็คเพระา string เป็น reference type สามารถเก็บค่า null ได้
// ส่วนตัวแปร int เป็นตัวแปรชนิด Value type ไม่สามารถเก็บค่า null ได้ เราจึงต้องใช้ operator Nullable (?) ช่วย เพื่อให้สามารถเก็บค่า null ได้
int? iCol2 = (dataCol2 == null || dataCol_2 == DBNull.Value) ? null : Convert.ToInt32(dataCol_2);