Bonjour,
j'aimerais savoir comment remplir une DropDownList à partir des données provenant d'une requête select:
voici ce que je fais, mais il ya rien dans ma dropdownlist
connexion=New SQLConnection(strcnx)
Dim reqSelectService as String="select serv_id,serv_nom from service"
command=New SqlCommand(reqSelectService, connexion)
connexion.Open()
Dim oReader As SqlDataReader = Command.ExecuteReader()
DropDownListService=New DropDownList()
Do
While oReader.Read()
DropDownListService.Items.Add(new ListItem(oReader.GetInt32(0),oReader.GetString(1)))
End While
Loop While oReader.NextResult()
oReader.Close()
DropDownListService.DataBind()
dans mon aspx:
<asp:dropDownList id="DropDownListService" runat="server"></asp:dropDownList></td>
je recupère bien les données de base
merci

 

 
		
		 
        

 
			
			




 Remplir une DropDownList
 Remplir une DropDownList
				 Répondre avec citation
  Répondre avec citation
Partager