private void PopulateData() 
{

UDS.Components.Staff staff = new UDS.Components.Staff();
listAccount.Items.Clear();
listAccount.DataSource = staff.GetAllStaffs();
listAccount.DataTextField = "RealName";
listAccount.DataValueField = "Staff_Name";
listAccount.DataBind ();

// listDept .DataSource = staff.GetPositionList(1);
// listDept.DataTextField = "Position_Name";
// listDept.DataValueField = "Position_ID";
// listDept.DataBind(); SqlConnection conn=new SqlConnection("server=localhost;uid=sa;pwd=mlspring99");
conn.Open();
SqlCommand cmd= new SqlCommand("select  *  from uds_position where  super_position_id<91 ",conn);

SqlDataReader reader = cmd.ExecuteReader();
int i=1;
while(reader.Read())
{

listDept.Items.Add(reader["position_name"].ToString());
listDept.Items.Insert(i++,new ListItem(reader["position_name"].ToString(),Convert.ToString(reader.GetInt32(1)))); } reader.Close();
cmd.Dispose();
conn.Close();
listDept.Items.Insert(0,new ListItem("公司所有部门","0"));
listDept.SelectedIndex = 0;
listDept.Attributes["onclick"]="SaveValue()";
staff=null;
}

#endregion #region 下拉列表事件
public void DeptListChange(object sender, System.EventArgs e)
{

UDS.Components.Staff staff = new UDS.Components.Staff();
if(listDept.SelectedItem.Value!="0")
{
Console.WriteLine();
listAccount.DataSource = staff.GetStaffByPosition(Convert.ToInt32(listDept.SelectedItem.Value.Trim()));
}
else
{
listAccount.DataSource = staff.GetAllStaffs();
}
listAccount.DataTextField = "RealName";
listAccount.DataValueField = "Staff_Name";
listAccount.DataBind ();
staff = null;
}
#endregion
运行后总是提示输入字符串的格式不正确
public ICollection  GetStaffByPosition(int PositionID) 
{
// create data object and params
SqlDataReader dataReader = null;
Database data = new Database();
DataTable datatable = new DataTable ();
SqlParameter[] prams = {
   data.MakeInParam("@PositionID",      SqlDbType.Int, 8, PositionID),
}; try 
{
// run the stored procedure
data.RunProc("sp_GetStaffByPosition", prams,out dataReader);
data = null;
datatable = UDS.Components.Tools.ConvertDataReaderToDataTable (dataReader);
return datatable.DefaultView ;
}
catch (Exception ex) 
{
Error.Log(ex.ToString());
return null;
}
}