TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Black Diamond
NA
236
108.5k
How datareader error
Sep 27 2011 2:30 AM
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?
Reply
Answers (
5
)
Copy tables data from sql server to access database
what is the key difference between dot net 2.0 and 3.5,4.0