Bonjour,
j'ai créé un site en aspnet avec une commande mais il y a une erreur dans mon code vb de la page panier et je n'arrive pas à la résoudre.
pouvez-vous m'aider svp?
merci d'avance

voici le code de la page vb
mon erreur se trouve dans le 1er while au niveau de ce code sur "Paniercds"
Code : Sélectionner tout - Visualiser dans une fenêtre à part
MyAdap.Fill(MyData, "Paniercds")
l'erreur est
Aucune valeur donnée pour un ou plusieurs objets requis.
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
 
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Session("NbArticle") = 0 Then
            MsgBox("Votre panier est vide. Sélectionnez vos articles !!!")
            Response.Redirect("ProduitType.aspx")
        End If
 
        Dim suppnl As String
        suppnl = Request.QueryString("Effnl")
        If suppnl <> "" Then
            'Pour le premier passage
            Dim i As Integer
            i = CInt(suppnl)
            Do While i < Session("NbArticle")
                Session(Str(i)) = Session(Str(i + 1))
                i = i + 1
            Loop
            Session(Str(i)) = ""
            Session("NbArticle") = Session("NbArticle") - 1
            If Session("NbArticle") = 0 Then Response.Redirect("ProduitType.aspx")
        End If
 
        Dim MyConn As OleDbConnection
        Dim MyAdap As OleDbDataAdapter
        Dim MyData As DataSet
        MyConn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Server.MapPath("App_Data/bdd_aspnet.mdb") & ";")
        MyConn.Open()
        MyData = New DataSet()
        Dim cpt As Integer
        cpt = 1
        While cpt <= CLng(Session("NbArticle"))
            MyAdap = New OleDbDataAdapter("Select * From T_Produit Where Ref Like " & CLng(Session(Str(cpt))), MyConn)
            MyAdap.Fill(MyData, "Paniercds")
            cpt = cpt + 1
        End While
        ' Mettons en page le panier en mode déconnecté
        Session("total") = 0
 
        'Mep en-tête panier
        Dim mRowHead As New TableRow()
 
        Dim mCellHeader As New TableHeaderCell()
        mCellHeader.Text = "Numéro ligne"
        'on souhaite que le texte soit centré horizontalement
        mCellHeader.HorizontalAlign = HorizontalAlign.Center
        mRowHead.Cells.Add(mCellHeader)
 
        mCellHeader = New TableHeaderCell()
        mCellHeader.Text = "N°Produit"
 
        mCellHeader.HorizontalAlign = HorizontalAlign.Center
        mRowHead.Cells.Add(mCellHeader)
 
        mCellHeader = New TableHeaderCell()
        mCellHeader.Text = "Libellé"
        mCellHeader.HorizontalAlign = HorizontalAlign.Left
        mRowHead.Cells.Add(mCellHeader)
 
        mCellHeader = New TableHeaderCell()
        mCellHeader.Text = "PU"
        mCellHeader.HorizontalAlign = HorizontalAlign.Left
        mRowHead.Cells.Add(mCellHeader)
 
        mCellHeader = New TableHeaderCell()
        mCellHeader.Text = "URL"
        mCellHeader.HorizontalAlign = HorizontalAlign.Right
        mRowHead.Cells.Add(mCellHeader)
 
        mCellHeader = New TableHeaderCell()
        mCellHeader.Text = "Annuler un article"
        mCellHeader.HorizontalAlign = HorizontalAlign.Center
        mRowHead.Cells.Add(mCellHeader)
        mTable.Rows.Add(mRowHead)
 
        'Mep corps panier
        Dim j As Integer = 1
        Dim row As DataRow = MyData.Tables("Paniercds").Rows(0)
        For Each row In MyData.Tables("Paniercds").Rows
            Dim mRow As New TableRow()
            Dim mCell As New TableCell()
 
            mCell = New TableCell()
            mCellHeader.ID = Str(j)
            mCell.Text = Str(j)
            mCell.HorizontalAlign = HorizontalAlign.Center
            mRow.Cells.Add(mCell)
 
            mCell = New TableCell()
            mCell.Text = row(0).ToString()
            mCell.HorizontalAlign = HorizontalAlign.Center
            mRow.Cells.Add(mCell)
 
            mCell = New TableCell()
            mCell.Text = row(1).ToString()
            mCell.HorizontalAlign = HorizontalAlign.Left
            mRow.Cells.Add(mCell)
 
            mCell = New TableCell()
            mCell.Text = row(2).ToString()
            mCell.HorizontalAlign = HorizontalAlign.Left
            mRow.Cells.Add(mCell)
 
            mCell = New TableCell()
            mCell.Text = row(3).ToString()
            Session("total") = Session("total") + CInt(row(3).ToString())
            mCell.HorizontalAlign = HorizontalAlign.Center
            mRow.Cells.Add(mCell)
 
            mCell = New TableCell()
            Dim mHyper As New HyperLink()
            mHyper.NavigateUrl = "Panier.aspx?Effnl=" + Str(j)
            mHyper.Text = "Effacer"
            mCell.HorizontalAlign = WebControls.HorizontalAlign.Center
            mCell.Controls.Add(mHyper)
            mRow.Cells.Add(mCell)
            j = j + 1
            mTable.Rows.Add(mRow)
        Next
 
        MyData.Dispose()
        MyData.Clear()
        MyConn.Close()
 
        'Mep pied panier
        Dim mRowfoot As New TableRow()
        Dim mCellFooter As New TableCell
        mCellFooter.Text = "Votre Total"
        'on souhaite que le texte soit centré horizontalement
        mCellFooter.HorizontalAlign = HorizontalAlign.Center
        mRowfoot.Cells.Add(mCellFooter)
 
        mCellFooter = New TableCell()
        mCellFooter.Text = ""
        mCellFooter.HorizontalAlign = HorizontalAlign.Center
        mRowfoot.Cells.Add(mCellFooter)
 
        mCellFooter = New TableCell()
        mCellFooter.Text = ""
        mCellFooter.HorizontalAlign = HorizontalAlign.Left
        mRowfoot.Cells.Add(mCellFooter)
 
        mCellFooter = New TableCell()
        mCellFooter.Text = ""
        mCellFooter.HorizontalAlign = HorizontalAlign.Left
        mRowfoot.Cells.Add(mCellFooter)
 
        mCellFooter = New TableCell()
        mCellFooter.Text = Session("total")
        mCellFooter.HorizontalAlign = HorizontalAlign.Center
        mRowfoot.Cells.Add(mCellFooter)
 
        mCellFooter = New TableCell()
        mCellFooter.Text = "Euros"
        mCellFooter.HorizontalAlign = HorizontalAlign.Center
        mRowfoot.Cells.Add(mCellFooter)
        mTable.Rows.Add(mRowfoot)
    End Sub