I get into DataSet CostumerNames and Hours (type DateTime) of their registrations.
I would like to sort customers my time of registration (time of a day).
I show both in listView.
This is my code:
string DanesRezervacije = "SELECT Stranka.ImePriimek, Naročilo.RegisterTime FROM Stranka, Naročilo " +
" WHERE Stranka.IDStranke = Naročilo.IDStrankeFK AND Naročilo.DatumRezervacije = @danes";
// THIS IS NOT WORKING: " + "ORDER BY Naročilo.DatumRezervacije ASC";
da = new SqlDataAdapter(DanesRezervacije, povezava);
da.SelectCommand.Parameters.Add("@danes", SqlDbType.DateTime).Value = DateTime.Today.Date;
DataSet ds = new DataSet();
da.Fill(ds, "DanašnjeRezervacije");
foreach (DataRow dr in ds.Tables[0].Rows)
{
ListViewItem lvi = new ListViewItem(dr["ImePriimek"].ToString());
lvi.SubItems.Add(Convert.ToDateTime(dr["RegisterTime"]).ToShortTimeString());
listViewLista.Items.Add(lvi);
}
}