using System.mySQLConnection;
using System.Data.SqlClient;
this.s_zhuanye.Items.Insert(0, new ListItem("请选择专业", "0"));
//this.s_zhuanye.DataSource = SqlConnections.GetDataTable("select o_id,o_outname from t_setclass where g_status=1 order by t_center", "table");
//this.s_zhuanye.DataTextField = "o_outname";
//this.s_zhuanye.DataValueField = "o_id";
//this.s_zhuanye.DataBind();
DataTable dt = System.mySQLConnection.SqlConnections.GetDataTable("select o_id,o_outname,t_center from t_setclass where g_status=1 order by t_center", "table");
DataView dv = new DataView(dt);
DataTable dtDistinct = dv.ToTable(true, new string[] { "t_center" });
ArrayList arraylist = new ArrayList();
arraylist.Capacity = 40000;
foreach (DataRow dr in dtDistinct.Rows)
{
arraylist.Add(dr["t_center"].ToString());
}
int arraycount = arraylist.Count;
for (int k = 0; k < arraycount; k++)
{
dv.RowFilter = "t_center='" + arraylist[k].ToString() + "'";
foreach (DataRow dr in dv.ToTable().Rows)
{
this.s_zhuanye.Items.Add(new ListItem(dr["o_outname"].ToString(),dr["o_id"].ToString()));
}
if (k != arraycount - 1)
{
this.s_zhuanye.Items.Add(new ListItem("-------------------------------------", ""));
}
}