Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6006015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:28:46+00:00 2026-05-23T01:28:46+00:00

conn.Open(); TableRow r = new TableRow(); TableCell c = new TableCell(); SqlDataReader reader =

  • 0
        conn.Open();

        TableRow r = new TableRow();
        TableCell c = new TableCell();

        SqlDataReader reader = comm.ExecuteReader();


          while (reader.Read())
        {
              c.Controls.Add(new LiteralControl(reader["Name"].ToString()));
                r.Cells.Add(c);
                Table1.Rows.Add(r);

                c.Controls.Add(new LiteralControl(reader["RollID"].ToString()));
                r.Cells.Add(c);
                Table1.Rows.Add(r);
        }

I’m using the above code to print data in table.But all fields are coming in a single row(Row not incrementing).Can you tell me how to display in multiple rows.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T01:28:47+00:00Added an answer on May 23, 2026 at 1:28 am

    At the moment, you are creating a single row and cell, and adding all of your controls to that single cell.

    While what you want is certainly possible (just make sure you create a new cell for each data element you pull out of your reader, and a new row for each iteration through the while loop), is there a reason you aren’t using something like a GridView to present this content?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I open a connection like this: Using conn as New OdbcConnection(connectionString) conn.Open() //do stuff
SQLiteConnection conn = new SQLiteConnection(Data Source=/data/bakkal.db3;); conn.Open(); conn.Close(); I am new at programming so
i have this code using (SqlConnection conn = new SqlConnection(ConnectionString)) { conn.Open(); DataTable Databases
***Coding in C# This works: NpgsqlConnection conn = new NpgsqlConnection(conx.getConexion()); conn.Open(); NpgsqlDataAdapter da =
If I use something like: using (OdbcConnection conn = new OdbcConnection(....)) { conn.open(); my
SqlConnection conn = new SqlConnection(AllQuestionsPresented.connectionString); SqlCommand cmd = new SqlCommand(sb.ToString(), conn); cmd.Parameters.Add(@ThreadsID, SqlDbType.Int).Value =
Given this code: using (var conn = new SqlConnection(...)) { conn.Open(); using (var cmd
using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings[connectionstring].ConnectionString)) { conn.Open(); using (SqlCommand cmd = conn.CreateCommand()) {
include(conn.php); $result = mysql_query(SELECT * FROM sggame); while($row = mysql_fetch_assoc($result)); { $id = $row['id'];
private int GetNextId() { SQLiteConnector conn = new SQLiteConnector(false); conn.OpenConnection(); cmd = new SQLiteCommand(SELECT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.