2 commented lines give errors..plz help me to correct it...im a biginner...
if (reader.Read())
if (reader.Read())
{
BE.InterestRate objir = new BE.InterestRate();
//objir.percentage = reader.GetFloat(Convert.ToString("percentage"));
//objir.percentage =float.Parse(Convert.ToString(reader.GetOrdinal("percentage")));
objir.Interest_Id = reader.GetInt32(reader.GetOrdinal("Interest_Id"));
objIR.Add(objir);
}

VulpesRank #55 · 29.2K reputationPosted Apr 13, 2011, 2:17 AM EDT
Incidentally, if the column could be null, it might be a good idea to check for that before reading any more values:
VulpesRank #55 · 29.2K reputationPosted Apr 13, 2011, 1:03 AM EDT
Tharake Gunatilake43 reputationPosted Apr 13, 2011, 1:14 AM EDT
following one works...
objir.Interest_Id = reader.GetInt32(reader.GetOrdinal("Interest_Id"));
I want to get the percentage....Plz help me....
VulpesRank #55 · 29.2K reputationPosted Apr 13, 2011, 1:17 AM EDT
1. The "percentage" column in the database; and
2. The objir.percentage property.
Is there any chance that the column could contain null values?
Tharake Gunatilake43 reputationPosted Apr 13, 2011, 1:29 AM EDT
2.this is the BE.InterestRate class
VulpesRank #55 · 29.2K reputationPosted Apr 13, 2011, 1:39 AM EDT
I'd test this hypothesis with:
objir.percentage = (float)reader.GetDouble(reader.GetOrdinal("percentage"));
Tharake Gunatilake43 reputationPosted Apr 13, 2011, 2:07 AM EDT
I have no words to thank you....Good luck..
I'm a sri lankan and tomorrow is our new year day...
Wish you a happy new year....
Tharake Gunatilake43 reputationPosted Apr 13, 2011, 2:44 AM EDT