Hi,
This is the code.
vote.Open();
string query = "SELECT FullNames from CouncilorsSubVotes order by FullNames";
SqlCommand all = new SqlCommand(query, vote);
SqlDataReader reader = all.ExecuteReader();
reader.Read();
string ReadCouncilorsVotes = reader[0].ToString() + "";
if (ReadCouncilorsVotes == null)
{ }
reader.Read();
string ReadCouncilorsVotes1 = reader[0].ToString() + ""; <---------------------null(It jump, it can't continue read the other reader, i want that if one of the string is null it proceed to the next.)
if (ReadCouncilorsVotes1 == null)
{ }
reader.Read();
string ReadCouncilorsVotes2 = reader[0].ToString() + "";
if (ReadCouncilorsVotes2 == null)
{ }
reader.Read();
string ReadCouncilorsVotes3 = reader[0].ToString() + "";
if (ReadCouncilorsVotes3 == null)
{ }
reader.Read();
string ReadCouncilorsVotes4 = reader[0].ToString() + "";
if (ReadCouncilorsVotes4 == null)
{ }
reader.Read();
string ReadCouncilorsVotes5 = reader[0].ToString() + "";
if (ReadCouncilorsVotes5 == null)
{ }
reader.Read();
string ReadCouncilorsVotes6 = reader[0].ToString() + "";
if (ReadCouncilorsVotes6 == null)
{ }
reader.Read();
vote.Close();
I want that if one of the reader become null it proceed to the next reader...how to fix this problem?
Loading

VulpesPosted Sep 27, 2011, 2:23 PM
Rahul MPosted Sep 28, 2011, 4:11 AM
Black DiamondPosted Sep 27, 2011, 1:25 PM
I already used while loop, but the data of my counter effected in while, which it cannot count correctly unlike when i use this code it counts correctly....the problem of this one, if one of my reader has read empty or null it cannot continue read to the next row of my table.....and i want to ask if there is a solution for that, in which even if it reads null or empty it continue read to the next rows...
Rahul MPosted Sep 27, 2011, 3:24 AM
Pravin MorePosted Sep 27, 2011, 3:10 AM
while(reader.Read())
{
string ReadCouncilorsVotes = reader[0].ToString() + "";
if (ReadCouncilorsVotes == null)
{
}
}
i mean how you want exactly...??
correct me if m wrong.....
Thanx,
Pravin.