Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Dataset from a DB, Sorting and Showing Contents

Dataset from a DB, Sorting and Showing Contents

Scheduled Pinned Locked Moved ASP.NET
databasealgorithmshelpannouncement
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mabuti
    wrote on last edited by
    #1

    I have a database with the columns of tblNewsID, Time, Date, News, User. What I am trying to do is to sort the data by the Date column and then pull each of the rows data into strings. With the code below I get the entries pulled out but not in any sorted order, they just come out as they were entered. I have tried all the help articles and I think that I am just very confused. In advance I appriciate any help that anyone can give me. conRCDB.Open(); cmdtblNews.Fill(dsNews); this.DataBind(); dsNews.tblNews.DefaultView.Sort = "Date ASC"; foreach (dsNews.tblNewsRow objNews in dsNews.tblNews) { string strTime = objNews.Time.ToShortTimeString(); string strDate = objNews.Date.ToLongDateString(); string strNews = objNews.News.ToString(); string strUser = objNews.User.ToString(); Label lblNews = new Label(); lblNews.Text = "" + strTime + ""; lblNews.Text += " " + strDate + ""; lblNews.Text += "
        " + strNews + ""; lblNews.Text += "
       -" + strUser + "

    "; panSiteNews.Controls.Add(lblNews); }

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups