Bonjour
Je fais une requete pour remplir un gridview avec une table Access, je veux afficher la premiere colonne de ma table CA01.
Pas de problème, le gridviewest rempli
Ensuite je veux ajouter des colonnes au gridview chacune d'elle sera remplie par les colonnes de ma table Access CA02 à CA15
Quand je lance l'appli mes colonnes CA02 à CA15 ne s'affichent pas, et je n'ai pas de beug.
Voici ma requete
Et voici mon gridview
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 Sub VoirCA() 'objet connection Using connexion As OleDbConnection = Me.DBConn Dim DBCommand As OleDbCommand 'Objet Dataset Dim DSPageData As New DataSet 'connection a la base de données DBCommand = New OleDbCommand("SELECT CA01 From CAsemaine Where Lan= ?" & " Order by NumJour", connexion) 'objet DataAdapter Dim myOleDbDataAdapter As New OleDbDataAdapter(DBCommand) DBCommand.Parameters.AddWithValue("Lan", Session("Lan2010")) myOleDbDataAdapter.SelectCommand.Parameters("Lan").Value = Session("Lan2010") myOleDbDataAdapter.Fill(DSPageData, "LePanier") GdvCA.DataSource = _ DSPageData.Tables("LePanier").DefaultView GdvCA.DataBind() Dim MadataTable As DataTable = DSPageData.Tables("LePanier") Dim i As Integer = 2 For i = 2 To 15 Dim maColumn As New DataColumn(String.Format("CA{0}", i.ToString("00"))) MadataTable.Columns.Add(maColumn) GdvCA.DataSource = _ DSPageData.Tables("LePanier").DefaultView GdvCA.DataBind() Next End Using End Sub
Je n'arrive pas à trouver l'erreur
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 <asp:GridView ID="GdvCA" runat="server" AutoGenerateColumns="False" ForeColor="#8F153E"> <selectedrowstyle backcolor="Yellow" font-bold="True" forecolor="Red" /> <Columns> <asp:templatefield headertext="S1"> <itemtemplate> <%#Eval("CA01", "{0:c}")%> </itemtemplate> <HeaderStyle BackColor="#DF5900" ForeColor="White" HorizontalAlign="Center" /> <ItemStyle HorizontalAlign="Right" Width="100px" ForeColor="Black" /> </asp:templatefield> </Columns> <RowStyle BackColor="#FFF7C6" /> <PagerStyle BackColor="#533B33" ForeColor="Black" HorizontalAlign="Right" /> <HeaderStyle BackColor="#533B33" Font-Bold="True" ForeColor="#D6A65C" /> <AlternatingRowStyle BackColor="#FFF09D" /> <EmptyDataTemplate> </EmptyDataTemplate> </asp:GridView>
Pouvez-vous m'aider
JCM
Partager