Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
3
Reply
i want to change the output from coumns to rowsusing string
narasiman rao
Dec 31 2015 10:55 PM
393
Reply
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#.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
3
)
Next Recommended Forum
mis à jour des variables
activation program