Click here to Skip to main content
15,850,214 members
Home / Discussions / C#
   

C#

 
GeneralRe: Notify User From Server Pin
Gerry Schmitz23-Mar-20 7:24
mveGerry Schmitz23-Mar-20 7:24 
QuestionCreate Custom File Property/Attribute Pin
Kevin Marois22-Mar-20 10:30
professionalKevin Marois22-Mar-20 10:30 
AnswerRe: Create Custom File Property/Attribute Pin
Tony Hill22-Mar-20 11:02
mveTony Hill22-Mar-20 11:02 
AnswerRe: Create Custom File Property/Attribute Pin
OriginalGriff22-Mar-20 11:14
mveOriginalGriff22-Mar-20 11:14 
GeneralRe: Create Custom File Property/Attribute Pin
Kevin Marois22-Mar-20 14:02
professionalKevin Marois22-Mar-20 14:02 
AnswerRe: Abuse Standard File Property/Attribute Pin
Luc Pattyn22-Mar-20 11:36
sitebuilderLuc Pattyn22-Mar-20 11:36 
GeneralRe: Abuse Standard File Property/Attribute Pin
Kevin Marois22-Mar-20 14:04
professionalKevin Marois22-Mar-20 14:04 
Questionupdate problem Pin
ago248620-Mar-20 0:31
ago248620-Mar-20 0:31 
Quote:
hello gentlemen and thank you to you who bring me your help. I am almost at the end of my program and I have an update problem. I don't see any change in my stock.
I have no error when I validate but the quantity does not change in the access database


C#
for (int i = 0; i < dataGridView1.Rows.Count; i++) //Car tu fais une infériorité stricte
                               {
                                   ref_prod = Convert.ToString(dataGridView1.Rows[i].Cells[0].Value);
                                   Qte_prod = Convert.ToInt64(dataGridView1.Rows[i].Cells[1].Value);

                                   using (OleDbCommand cmd3 = sql_con.CreateCommand())
                                   {

                                       cmd3.CommandText = "INSERT INTO Detail_commandes (com_det, ref_det, qute_det) VALUES (@com_det,@ref_det,@qute_det)";
                                       cmd3.Parameters.AddWithValue("@com_det", TxtNunCmd.Text);
                                       cmd3.Parameters.AddWithValue("@ref_det", ref_prod);
                                       cmd3.Parameters.AddWithValue("@qute_det", Qte_prod);
                                       sql_con.Open();
                                       cmd3.ExecuteNonQuery();
                                       sql_con.Close();

                                   }

                                   using (OleDbCommand cmd4 = sql_con.CreateCommand())
                                   {
                                       //setConnection();
                                       OleDbCommand QteStock = sql_con.CreateCommand();
                                       QteStock.CommandText = "SELECT Quantite FROM Catalogue";
                                       sql_con.Open();
                                       int LastQteStock = Convert.ToInt32(QteStock.ExecuteScalar());
                                       sql_con.Close();
                                       cmd4.CommandText = "UPDATE Catalogue SET Quantite = @Quantite - @QteStc WHERE code_article = (@code_article)";
                                       cmd4.Parameters.AddWithValue("@Quantite", LastQteStock);
                                       cmd4.Parameters.AddWithValue("@QteStc", Qte_prod);
                                       cmd4.Parameters.AddWithValue("@code_article", TxtRefProduit.Text);
                                       sql_con.Open();
                                       cmd4.ExecuteNonQuery();
                                       sql_con.Close();

                                   }
                           }

AnswerRe: update problem Pin
OriginalGriff20-Mar-20 1:03
mveOriginalGriff20-Mar-20 1:03 
GeneralRe: update problem Pin
ago248620-Mar-20 1:08
ago248620-Mar-20 1:08 
GeneralRe: update problem Pin
ago248620-Mar-20 3:52
ago248620-Mar-20 3:52 
GeneralRe: update problem Pin
OriginalGriff20-Mar-20 4:00
mveOriginalGriff20-Mar-20 4:00 
GeneralRe: update problem Pin
ago248620-Mar-20 4:10
ago248620-Mar-20 4:10 
Questionproblem to make a second recording Pin
ago248619-Mar-20 0:58
ago248619-Mar-20 0:58 
AnswerRe: problem to make a second recording Pin
OriginalGriff19-Mar-20 1:06
mveOriginalGriff19-Mar-20 1:06 
GeneralRe: problem to make a second recording Pin
ago248619-Mar-20 1:29
ago248619-Mar-20 1:29 
GeneralRe: problem to make a second recording Pin
OriginalGriff19-Mar-20 1:35
mveOriginalGriff19-Mar-20 1:35 
GeneralRe: problem to make a second recording Pin
ago248619-Mar-20 1:48
ago248619-Mar-20 1:48 
GeneralRe: problem to make a second recording Pin
OriginalGriff19-Mar-20 1:52
mveOriginalGriff19-Mar-20 1:52 
GeneralRe: problem to make a second recording Pin
ago248619-Mar-20 1:59
ago248619-Mar-20 1:59 
GeneralRe: problem to make a second recording Pin
ago248619-Mar-20 3:06
ago248619-Mar-20 3:06 
GeneralRe: problem to make a second recording Pin
OriginalGriff19-Mar-20 3:26
mveOriginalGriff19-Mar-20 3:26 
GeneralRe: problem to make a second recording Pin
ago248619-Mar-20 4:04
ago248619-Mar-20 4:04 
GeneralRe: problem to make a second recording Pin
OriginalGriff19-Mar-20 4:22
mveOriginalGriff19-Mar-20 4:22 
GeneralRe: problem to make a second recording Pin
ago248619-Mar-20 4:27
ago248619-Mar-20 4:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.