Click here to Skip to main content
15,886,873 members
Home / Discussions / C#
   

C#

 
GeneralRe: recording problem Pin
ago248617-Mar-20 2:43
ago248617-Mar-20 2:43 
GeneralRe: recording problem Pin
OriginalGriff17-Mar-20 2:51
mveOriginalGriff17-Mar-20 2:51 
GeneralRe: recording problem Pin
ago248617-Mar-20 3:02
ago248617-Mar-20 3:02 
GeneralRe: recording problem Pin
OriginalGriff17-Mar-20 3:17
mveOriginalGriff17-Mar-20 3:17 
GeneralRe: recording problem Pin
ago248617-Mar-20 3:24
ago248617-Mar-20 3:24 
GeneralRe: recording problem Pin
OriginalGriff17-Mar-20 3:38
mveOriginalGriff17-Mar-20 3:38 
GeneralRe: recording problem Pin
ago248617-Mar-20 3:52
ago248617-Mar-20 3:52 
GeneralRe: recording problem Pin
OriginalGriff17-Mar-20 4:08
mveOriginalGriff17-Mar-20 4:08 
Yes - and that's because the new keyword creates a new, empty instance of the List and throws away the old one when it is assigned to the variable.

And your code does exactly the same thing:
C#
...
sql_cmd.Parameters.AddWithValue("@Prix_total_HT", total);
sql_cmd = new OleDbCommand(txtQuery, sql_con);
sql_cmd.ExecuteNonQuery();
You load up the parameters into an OleDbCommand instance, and then throw it all away to create a new, empty instance and store it in the same variable.

To be honest, if you are "just a beginner who learns through some tutorials" then you are doing it all wrong, particularly if these are YouTube tutorials - I've yet to see one that is of any real use whatsoever. Instead, look for a good book on the subject - Apress, Wrox, Addison Wesley, Microsoft Press - they all do excellent beginner volumes though I don't know if any of them are available in French. If you can, look for a copy of "Pro C# 8.0" (APress, I believe), or "C# in a nutshell" (O'Reilly?) - I learnt from those one many, many years ago when .NET was at V2!
Books introduce the material in a structured way, building on what has been taught before - and aren't written just to get views and subscribers...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!

GeneralRe: recording problem Pin
ago248617-Mar-20 4:28
ago248617-Mar-20 4:28 
GeneralRe: recording problem Pin
OriginalGriff17-Mar-20 4:31
mveOriginalGriff17-Mar-20 4:31 
GeneralRe: recording problem Pin
ago248617-Mar-20 4:39
ago248617-Mar-20 4:39 
AnswerRe: recording problem Pin
ZurdoDev17-Mar-20 2:39
professionalZurdoDev17-Mar-20 2:39 
GeneralRe: recording problem Pin
OriginalGriff17-Mar-20 2:52
mveOriginalGriff17-Mar-20 2:52 
GeneralRe: recording problem Pin
ZurdoDev17-Mar-20 2:59
professionalZurdoDev17-Mar-20 2:59 
GeneralRe: recording problem Pin
Luc Pattyn17-Mar-20 12:08
sitebuilderLuc Pattyn17-Mar-20 12:08 
GeneralRe: recording problem Pin
ago248617-Mar-20 22:04
ago248617-Mar-20 22:04 
GeneralRe: recording problem Pin
Luc Pattyn17-Mar-20 22:18
sitebuilderLuc Pattyn17-Mar-20 22:18 
GeneralRe: recording problem Pin
ago248617-Mar-20 23:20
ago248617-Mar-20 23:20 
AnswerRe: problem to retrieve an info in a sql request / problème pour recéper une info dans une requête sql Pin
Richard Deeming16-Mar-20 9:28
mveRichard Deeming16-Mar-20 9:28 
Generalproblem registering in the access database Pin
ago248617-Mar-20 0:58
ago248617-Mar-20 0:58 
GeneralRe: problem registering in the access database Pin
Richard Deeming17-Mar-20 1:01
mveRichard Deeming17-Mar-20 1:01 
GeneralRe: problem registering in the access database Pin
ago248617-Mar-20 1:08
ago248617-Mar-20 1:08 
GeneralRe: problem registering in the access database Pin
Richard Deeming17-Mar-20 1:10
mveRichard Deeming17-Mar-20 1:10 
GeneralRe: problem registering in the access database Pin
ago248617-Mar-20 1:17
ago248617-Mar-20 1:17 
GeneralRe: problem registering in the access database Pin
Richard Deeming17-Mar-20 1:35
mveRichard Deeming17-Mar-20 1:35 

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.