cs_fayrous
Messages postés48Date d'inscriptionlundi 23 février 2009StatutMembreDernière intervention30 avril 2009
-
20 mars 2009 à 23:26
nhervagault
Messages postés6063Date d'inscriptiondimanche 13 avril 2003StatutMembreDernière intervention15 juillet 2011
-
23 mars 2009 à 15:43
Salut,
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
GroupBox[] box = new GroupBox[200];
Label[] lab = new Label[200];
CheckBox[] check = new CheckBox[200];
ComboBox[] cb = new ComboBox[200];
private void afficher_Click(object sender, EventArgs e)
{
string connection = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Documents and Settings\\Administrateur\\Bureau\\BASE/bd1.mdb";
using (OleDbConnection con = new OleDbConnection(connection))
{
try
{
//ouverture de la connection
con.Open();
for (int i = 0; i < 5; i++)
{
using (OleDbCommand com = new OleDbCommand("insert into Correction values( @nr,@nq,@nc)", con))
{
com.Parameters.Add("@nr", OleDbType.Integer).Value = check[i].Name;
com.Parameters.Add("@nq", OleDbType.Integer).Value = cb[i].SelectedItem;
for (int j = 0; j < 10; i++)
com.Parameters.Add("@nc", OleDbType.Integer).Value = box[i].Name;
com.ExecuteNonQuery();
}
}
MessageBox.Show("OK");
}
catch (Exception ex)
{
MessageBox.Show(String.Format("Erreur.Message:'{0}'", ex.Message));
}
finally
{
con.Close();
}
}
}
}
}
S.V.P pouvez vous me dire pourquoi il y a un erreur
au niveau de l'enregistrement des données