0
你好,我有一個問題,我想通過一天命令他們顯示日期到現在什麼生日至上,爲前:我有ORDER BY DAY無論是年或月
15/08/2013 00:00:00
15/08/2013 00:00:00
29/08/2012 00:00:00
23/08/2012 00:00:00
16/08/2012 00:00:00
10/08/2012 00:00:00
我希望它是
10/08/2012 00:00:00
15/08/2013 00:00:00
15/08/2013 00:00:00
16/08/2012 00:00:00
23/08/2012 00:00:00
29/08/2012 00:00:00
我寫道:
public DataTable BirtdayReport(DateTime d)
{
try
{
string query = "SELECT C.Class_Name as [כיתה], P.Person_First_Name as [שם פרטי], P.Person_Last_Name as [שם משפחה], P.Date_Of_Birth AS [תאריך לידה] ";
query += "FROM Person as P INNER JOIN Customer as C ON P.[Person _ID] = C.Person_ID WHERE MONTH(P.Date_Of_Birth)=Month(@d) ORDER BY (DAYOFMONTH(Person.Date_Of_Birth)) ;";
OleDbCommand command = new OleDbCommand();
command.CommandText = query;
command.Parameters.AddWithValue("@d", d);
DataTable dt = AdoHelper.ExecuteDataTable(command);
return dt;
}
catch (Exception ex)
{
throw ex;
}
}
但排序它不喜歡我想要的。 你能幫助我嗎?
這似乎是正確的,從這裏 – xanatos
數據庫MySQL的是?什麼是isqlquery? – xanatos
它輸出了什麼?你是否在順序下降後? – Sayse