i want to change the output from columns to rows using string builder in asp.net
My code as follows
System.Text.StringBuilder sbNews = new System.Text.StringBuilder();
string myConString = ConfigurationManager.ConnectionStrings["Reception2_DB"].ConnectionString;
using (SqlConnection conn = new SqlConnection(myConString))
{
string query;
query = Select Subject,Description,Link,Entereddate from LatestNewsMaster and active <>'d'";
SqlCommand cmd = new SqlCommand(query, conn);
conn.Open();
using (SqlDataReader rdr = cmd.ExecuteReader())
{
while (rdr.Read())
{
sbNews.Append(rdr[3].ToString() + "
");
sbNews.Append(rdr[0].ToString() + "
");
sbNews.Append(rdr[1].ToString() + "
");
sbNews.Append(rdr[2].ToString() + "
");
}
}
NewsTicker = sbNews.ToString();
}
In database record as follows
Subject Description Link entereddate
Defects Defects page Defects.aspx 22Dec2015
Accounts Accounts Page Accounts.aspx 29Dec2015
When i run the above code output as follows
22Dec2015
Defects
Defects page
Defects.aspx
22Dec2015
Accounts
Accounts Page
Accounts.aspx
But i want the output as follows in the run mode as follows
22Dec2015 Defects Defects page Defects.aspx
22Dec2015 Accounts Accounts page Accounts.aspx
for that how can i do in asp.net using c#.