The problem is not the number of rows that are read - though without your data we can't check that, there may only be one row in the "Movies" table - but that
C_E
will always have the same value when you exit the loop - the last value read from the data.
I have no idea what your
Update
method does, but if you want to assemble all the values from your DB you need to do something like this:
using (SqlDataReader sdr = cmd.ExecuteReader())
{
StringBuilder sb = new StringBuilder();
while (sdr.Read())
{
string temp = sdr["Code"].ToString();
if (string.IsNullOrEmpty(temp))
{
sb.Append("0");
}
else
{
sb.Append(temp);
}
this.Update(temp);
}
C_E = sb.ToString();
}