B
Brian Conway
I need some help on binding a datareader to a dropdown box. I have included
the code for the dropdown below. It builds with no errors, but returns no
results. Any help would be appreciated.
private void DropDownList1_SelectedIndexChanged(object sender,
System.EventArgs e)
{
OleDbConnection conn = new OleDbConnection("DataSource=ntdrp001.world;
integrated security =true;"+ "initial catalog = Request");
conn.Open();
OleDbCommand cmd = new OleDbCommand("SELECT distinct(cuid) from Request",
conn);
OleDbDataReader dreader = cmd.ExecuteReader();
DropDownList1.DataSource = dreader;
DropDownList1.DataValueField = "cuid";
DropDownList1.DataTextField = "cuid";
DropDownList1.SelectedIndex = 0;
DropDownList1.DataBind();
dreader.Close();
conn.Close();
}
the code for the dropdown below. It builds with no errors, but returns no
results. Any help would be appreciated.
private void DropDownList1_SelectedIndexChanged(object sender,
System.EventArgs e)
{
OleDbConnection conn = new OleDbConnection("DataSource=ntdrp001.world;
integrated security =true;"+ "initial catalog = Request");
conn.Open();
OleDbCommand cmd = new OleDbCommand("SELECT distinct(cuid) from Request",
conn);
OleDbDataReader dreader = cmd.ExecuteReader();
DropDownList1.DataSource = dreader;
DropDownList1.DataValueField = "cuid";
DropDownList1.DataTextField = "cuid";
DropDownList1.SelectedIndex = 0;
DropDownList1.DataBind();
dreader.Close();
conn.Close();
}