Bonjour,

J'ai un petit souci d'insertion de données avec un datagridview.
J'aimerais que tous les données de ma colonne 2,qui n'est lié a aucune table de ma base de données s'insére dans un champ de la table temp de ma BDD.
Je tiens a préciser que la donnée NomProjet s'insére trés bien et que le souci vient du champ NbJours.je vous envoi ci joint un bout du code et vous remercie d'avance.


DataSet data_projet = new DataSet();


for (int k = 0; k < dataGridView2.Rows.Count; k++)
{
command = new SqlCommand("INSERT INTO dbo.T_TEMPS(Num,Periode, Salarie, Service, Projet, NbJours, Commentaires) VALUES (@guidValue,'df','er','egr',@NomProjet," + dataGridView1.Rows[k].Cells["NbJours"].Value +",'rg');", connexion);
command.Parameters.AddWithValue("@guidValue", Guid.NewGuid());
command.Parameters.Add("@NbJours", SqlDbType.VarChar, 50);

// dataGridView2.Rows[j].Cells[0].Value = row["NomProjet"];
// command.Parameters["@NbJours"].Value = NbJours;//dataGridView2.Rows[j].Cells[1].Value;
}
foreach (DataRow row in data_projet.Tables[0].Rows)
{
if (j <= data_projet.Tables[0].Rows.Count)
{
command.Parameters.Add("@NomProjet", SqlDbType.VarChar, 50);
command.Parameters["@NomProjet"].Value = row["NomProjet"];
}
command.ExecuteNonQuery();
}