Why my code only read one row?

  • Thread starter Thread starter Neraks
  • Start date Start date
N

Neraks

Guest
My table have 10 récords and when i use my method only have a "0" that means only read one record because only the first row field is null another fields is not nulls

Query

string query = "SELECT * FROM Movies";

Method

using (SqlDataReader sdr = cmd.ExecuteReader())
{
while (sdr.Read())
{

if (string.IsNullOrEmpty(sdr["Code"].ToString()))
{
C_E = "0";
this.Update(C_E);
//ViewBag.Message = "cero";
}
else
{
C_E = sdr["Code"].ToString();
this.Update(C_E);
// ViewBag.Message = C_E;
}


}

Continue reading...
 
Back
Top