Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Data reader function for listbox(S)
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Data reader function for listbox(S)
Divers
Thread ID:
00777702
Message ID:
00777702
Vues:
42
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();

}
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform