DataSet dataSet = new DataSet();
// conn.Open();
SqlDataAdapter adapter;
adapter = new SqlDataAdapter(SQL2, conn);
adapter.SelectCommand.Parameters.Add(new SqlParameter("@DSCRIPTN", strJobTitle));
adapter.Fill(dataSet, "Jobs");
int intCount = dataSet.Tables["Jobs"].Rows.Count;
if (intCount > 0)
{
//Add the None Chosen item and the replacement item to the Available Jobs list
drpAvailableJobs.Items.Insert(0, new ListItem("None Chosen", ""));
drpAvailableJobs.Items.Insert(1, new ListItem("Replacement", "000000"));
}
else
{
//Add No positions availble to the list when there are not records;
drpAvailableJobs.Items.Insert(0, new ListItem("No Positions Available", "None"));
drpAvailableJobs.Items.Insert(1, new ListItem("Replacement", "000000"));
}
drpAvailableJobs.DataSource = dataSet;
drpAvailableJobs.DataMember = "Jobs";
drpAvailableJobs.DataBind();
|