Gérer le forum:  Aide  •  Rechercher  •  Liste des Membres  •  Groupes d'utilisateurs   •  S'enregistrer  •  Profil  •  Se connecter pour vérifier ses messages privés  •  Connexion 
 Pti ASP NET Panier Voir le sujet suivant
Voir le sujet précédent
Poster un nouveau sujetRépondre au sujet
Auteur Message
amour076
Newbiiiie
Newbiiiie


BTS IG - Option développeur 2ème année
Sexe: Sexe:Féminin
Messages: 2

MessagePosté le: Ven 11 Juin 2010 - 11:36 Répondre en citantRevenir en haut

bonjour,
j'ai créé une pti asp net avec commande de produits. mais j'ai un problème ma page panier ne fonctionne pas à cet endroit :
Code:
MyAdap.Fill(MyData, "Paniercds")

avec l'erreur
Citation:
Aucune valeur donnée pour un ou plusieurs des paramètres requis.


en fait quand j'ouvre mon panier, les produits commandés s'affichent dans un tableau.
merci de votre aide

je vous fourni également le code vb complet pour plus de compréhension :

Code:
 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
Voir le profil de l'utilisateurEnvoyer un message privé

N'oubliez pas de vous inscrire à la communauté pour participer. Si vous êtes déjà membre, connectez-vous pour faire disparaître ce bandeau publicitaire.
V_pour_V
Forumeur fréquent
Forumeur fréquent




Messages: 61

MessagePosté le: Ven 11 Juin 2010 - 14:04 Répondre en citantRevenir en haut

Code:

MyAdap = New OleDbDataAdapter("Select * From T_Produit Where Ref Like " & CLng(Session(Str(cpt))), MyConn)


Dans ta requête, Ref est de type chaine de caractère? Si oui tu dois le mettre entre quotes, ca donne :

Code:

MyAdap = New OleDbDataAdapter("Select * From T_Produit Where Ref Like '" & CLng(Session(Str(cpt))) & "'", MyConn)


Mais pourquoi un Like et pas un = ? vu que tu ne mets pas de jokers (% sous oracle, mysql, ... ou * sous Access)
Voir le profil de l'utilisateurEnvoyer un message privé
amour076
Newbiiiie
Newbiiiie


BTS IG - Option développeur 2ème année
Sexe: Sexe:Féminin
Messages: 2

MessagePosté le: Lun 14 Juin 2010 - 20:22 Répondre en citantRevenir en haut

Bonjour,
désolé du retard
j'ai résolu mon problème
j'avais oublié de changer ref dans la requete par mon no produit
et j'ai passé aujourd'hui mes pti et je suis tombée sur ma base access
voila
merci de ton aide
Voir le profil de l'utilisateurEnvoyer un message privé
Montrer les messages depuis:      
Poster un nouveau sujetRépondre au sujet
    Sujets complémentaires :
 Sauter vers:   



Voir le sujet suivant
Voir le sujet précédent
Vous ne pouvez pas poster de nouveaux sujets dans ce forum
Vous ne pouvez pas répondre aux sujets dans ce forum
Vous ne pouvez pas éditer vos messages dans ce forum
Vous ne pouvez pas supprimer vos messages dans ce forum
Vous ne pouvez pas voter dans les sondages de ce forum