Insertion de données à partir d'un côntrol Repeater
Bonjour j'ai écris ce code pour l'insertion des données dans une table de base de donnée sql server
Code:
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
|
protected void btnFinSaisi_Click1(object sender, EventArgs e)
{
VenteClients p = new VenteClients();
foreach (RepeaterItem item in rptrValiderVente.Items)
{
Label lblIdarticle = (Label)item.FindControl("lblIdarticle");
Label lblPu = (Label)item.FindControl("lblPu");
Label lblQuantite = (Label)item.FindControl("lblQuantite");
Label lblNumbon = (Label)item.FindControl("lblNumbon");
Label lblTva = (Label)item.FindControl("lblTva");
p.IdAgences = Convert.ToInt32(Session["IdAgences"]);
p.IdDepot = Convert.ToInt32(ddlDepot.SelectedItem.Value);
p.Idarticle = Convert.ToInt32(lblIdarticle);
p.IdClients = Convert.ToInt32(ddlClient.SelectedItem.Value);
p.IdUtilisateur = Convert.ToInt32(Session["USERID"]);
p.LIVRER = "NON ";
p.QUANTITE = Convert.ToDecimal(lblQuantite);
p.PU = Convert.ToDecimal(lblPu);
p.Dates = Convert.ToDateTime(txtDate.Text);
p.NumBC = (lblNumbon.Text);
p.NumBL = lblNumbon.Text;
p.Numpiece = Convert.ToInt32(ddd);
p.NumFAC = txtNumeroFacture.Text;
p.Confirm = Convert.ToInt32(ddd);
p.Encaissement = Decimal.Parse(txtQuantite.Text);
p.Reste = Decimal.Parse(txtQuantite.Text);
p.Total = Decimal.Parse(txtQuantite.Text);
p.Rabais = Convert.ToDecimal(txtQuantite.Text);
p.Ristourne = Decimal.Parse(txtQuantite.Text);
p.Escompte = Decimal.Parse(txtQuantite.Text);
p.Reduct = Convert.ToDecimal(txtQuantite.Text);
p.PuNegos = Convert.ToDecimal(txtQuantite.Text);
p.TotalReduction = Decimal.Parse(txtQuantite.Text);
p.Douane = Convert.ToDecimal(txtQuantite.Text);
p.TvaDouane = Convert.ToDecimal(lblTva);
p.Cabotage = Convert.ToDecimal(lblTva);
p.TvaCabotage = Convert.ToDecimal(lblTva);
p.SoutienEtat = Convert.ToDecimal(lblTva);
p.Precompte = Convert.ToDecimal(lblTva);
p.RedevancePort = Convert.ToDecimal(lblTva);
p.TvaRedevancePort = Convert.ToDecimal(lblTva);
Insert i = new Insert();
string k = i.InsertVenteClient(p);
if (k == "-1")
{
Response.Write("<script> alert('Rééssailler encore'); </script>");
}
}
{
Response.Write("<script> alert('Ajout effectué avec succés'); </script>");
}
} |
mais cela me génère l'erreur suivante:
Pièce jointe 609444
pouvez vous m'aider à corrigé se problème? s'il vous plais