Lennie Kuah

Lennie Kuah

  • NA
  • 29
  • 0

C#.Net2008 Check DBNull using IF

Apr 4 2010 6:12 AM

Hi there,
I am trying to NULL value from DataReader date using C#.NEt 2008 but it generate error message from the coding list below
if (sqlDR(
"CustomerID") != System.DBNull.Value) { this.txtCustID.Text = sqlDR("CustomerID"); }
if (sqlDR(
"OrderDate") != System.DBNull.Value) { this.txtOrderDate.Text = sqlDR("OrderDate"); }
if (sqlDR(
"ReqDate") != System.DBNull.Value) { this.txtRequiredDate.Text = sqlDR("ReqDate"); }
if (sqlDR(
"ShipDate") != System.DBNull.Value) { this.txtShipDate.Text = sqlDR("ShipDate"); }
if (sqlDR(
"TransFee") != System.DBNull.Value) { this.txtFreight.Text = sqlDR("TransFee"); }
 
This is the error message:
Error 1 FrmOrderMaint.sqlDR' is a 'field' but is used like a 'method' 
 

Answers (3)