排序问题,请教高手!
代码如下:
<%# numm1(System.Convert.ToInt32(DataBinder.Eval(Container.DataItem, "qz_id "))) %> 人
---------------------------------------------
protected int numm1(int hfshu)
{
SqlConnection myConn1 = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings[ "connectionString "]);
string mySel1= "SELECT count(*) as iCount from qz_cy where qz_id= ' "+hfshu+ " ' ";
SqlCommand myCmd11=new SqlCommand(mySel1,myConn1);
myCmd11.Connection.Open();
SqlDataReader Dr11=myCmd11.ExecuteReader();
Dr11.Read();
int Count1=System.Convert.ToInt32(Dr11[ "iCount "])+System.Convert.ToInt32(1);
Dr11.Close();
myCmd11.Connection.Close();
return Count1;
}
public void BindGrid1()
{
SqlConnection MyConnection = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings[ "connectionString "]);
string strSel1 = "select * from qz ORDER BY qz_time DESC ";
DataSet MyDataSet = new DataSet();
SqlDataAdapter myCommand = new SqlDataAdapter(strSel1,MyConnection);
myCommand.Fill(MyDataSet, "999 ");
DataGrid1.DataSource = MyDataSet.Tables[ "999 "].DefaultView;
DataGrid1.DataBind();
}
---------------------------------------
现在的排序是按qz_time这个时间字段来排序的。
我想改成按返回Count1的值来排序,如何实现?
------解决方案--------------------???