Page 1091 - IT2
P. 1091

<asp:datagrid id="DataGrid1" runat="server" CellSpacing="1"
               GridLines="None" CellPadding="3" BackColor="White" ForeColor="Black"
               EnableViewState="False">
                           <HeaderStyle font-bold="True" forecolor="white"
               backcolor="#4A3C8C"></HeaderStyle>
                           <ItemStyle backcolor="#DEDFDE"></ItemStyle>
                       </asp:datagrid>
                       <asp:SqlDataSource ID="SqlDataSource1" runat="server"
                           ConnectionString="<%$ConnectionStrings:OFPPTConnectionString%>"
                           SelectCommand="SELECT [num_filiaire] FROM
               [filiaire]"></asp:SqlDataSource>
                   </form>
               </body>
               </html>
               CodeBehind
               Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object,
               ByVal e As EventArgs) Handles DropDownList1.SelectedIndexChanged
                       Dim ConnectionString As String =
               "server=.\netsdk2;database=ofppt;trusted_connection=true"
                       Dim CommandText As String
                       Dim filtre As String = DropDownList1.SelectedValue
                       CommandText = "select s.* from stagiaire s,groupe g where
               g.num_groupe=s.num_groupe and g.num_filiere=" & filtre
                       Dim myConnection As New SqlConnection(ConnectionString)
                       Dim myCommand As New SqlCommand(CommandText, myConnection)
                       myConnection.Open()
                       DataGrid1.DataSource = myCommand.ExecuteReader()
                       DataGrid1.DataBind()
                       myConnection.Close()
                   End Sub





























                                                                                                       6/5

                                        www.itlearning-settat.com

                                  Email: admission@itlearning-settat.com

                                                  Tél.:0661077812
   1086   1087   1088   1089   1090   1091   1092   1093   1094   1095   1096