In addition to the two postings above..
1. You have a typo in your first command string.. (seelct instead of select)
2. Do yourself a favor and use parameterized calls, always, even if your var is read from a database.
3. When I'm not wrong
SqlDataReader rs = new SqlDataReader()
should result in an error.
See code below...
SqlConnection con = Database.GetConnection();
SqlCommand com = new SqlCommand( "SELECT * FROM category WHERE article_allow = 1", con );
string article_visit = "0";
SqlDataReader rs = com.ExecuteReader();
while ( rs.Read() )
{
SqlCommand cmd = new SqlCommand( "SELECT article_visit FROM article_list WHERE cat_ID = @catID AND article_status=1", secondCon );
cmd.Parameters.AddWithValue( "catID", rs[ "cat_ID" ] );
SqlDataReader rst = cmd.ExecuteReader();
while ( rst.Read() )
{
article_visit = rst[ "article_visit" ] + article_visit;
}
rst.Close();
rst.Dispose();
cmd.Dispose();
}
rs.Close();
rs.Dispose();
Edit.
Sorry, my fault.
It is not possible to use the same connection for the second reader while the first is still open.
You have to use another connection to your database for the second reader.
So create a new connection and modify the second SqlCommand to use the new connection..
Edit 2/3
Updated Code example