Question is how to get the actual list box to be understood in this new
function? Like a macro substtion.
I have to create 20+ dropdowns so I am Data reader happy. How do I pass the
DropdownList & # Below is the code for #3:
strConnection= my_connection;
strSQLforListBox = "SELECT distinct ap_fillc1 fillc1 from dbo.depappl order
by 1 ";
SqlConnection objConnection2 = new SqlConnection(strConnection);
SqlCommand objCommand2 = new SqlCommand(strSQLforListBox, objConnection2);
objConnection2.Open();
MmDropDownList3.DataSource = objCommand2.ExecuteReader();
MmDropDownList3.DataTextField = "fillc1";
MmDropDownList3.DataBind();
objConnection2.Close();
public void HappyReader (String SqlCon, string SqlString, string lclistBox,
string lcColumn)
{
SqlConnection objConnection = new SqlConnection(SqlCon);
SqlCommand objCommand = new SqlCommand(strSQLforListBox, objConnection);
objConnection.Open();
lcListbox.DataSource = objCommand.ExecuteReader();
lcListbox.DataTextField = lcColumn;
lcListbox.DataBind();
objConnection.Close();
}