Click here to Skip to main content
15,885,278 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to use RegEx for AlphaNumeric expressions Pin
Gerry Schmitz29-Nov-17 4:52
mveGerry Schmitz29-Nov-17 4:52 
QuestionEntity FrameWork Question Pin
Kevin Marois28-Nov-17 6:08
professionalKevin Marois28-Nov-17 6:08 
AnswerRe: Entity FrameWork Question Pin
Richard MacCutchan28-Nov-17 6:11
mveRichard MacCutchan28-Nov-17 6:11 
GeneralRe: Entity FrameWork Question Pin
Kevin Marois28-Nov-17 6:15
professionalKevin Marois28-Nov-17 6:15 
GeneralRe: Entity FrameWork Question Pin
Richard MacCutchan28-Nov-17 6:18
mveRichard MacCutchan28-Nov-17 6:18 
GeneralRe: Entity FrameWork Question Pin
Kevin Marois28-Nov-17 6:19
professionalKevin Marois28-Nov-17 6:19 
QuestionParameterized Command Not Adding To DB Pin
MsJane27-Nov-17 8:21
MsJane27-Nov-17 8:21 
AnswerRe: Parameterized Command Not Adding To DB Pin
Sascha Lefèvre27-Nov-17 8:54
professionalSascha Lefèvre27-Nov-17 8:54 
You're continuously adding more parameters to the OleDbCommand.Parameters-collection when you only ever need a single one. The first one you add is being used for every command execution.

Store the parameter in a variable, add it to the parameters-collection only once and then modify its value instead in the loop.

Also, I would recommend you to use all your OleDb*-objects that are disposable, in a using-block:
C#
using (OleDbConnection con = new OleDbConnection())
using (OleDbCommand cmd = new OleDbCommand())
{
// ...

// and no con.Close() neccessary any more then
}

That's the cleanest way to ensure you're not leaking resources. Goes for everything else that implements IDiposable as well, not only database-objects.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

AnswerRe: Parameterized Command Not Adding To DB Pin
Richard MacCutchan27-Nov-17 22:06
mveRichard MacCutchan27-Nov-17 22:06 
AnswerRe: Parameterized Command Not Adding To DB Pin
MsJane30-Nov-17 5:13
MsJane30-Nov-17 5:13 
Questionhow to get programmatically the selected item of a treeview dynamically built Pin
Hervend27-Nov-17 2:02
Hervend27-Nov-17 2:02 
AnswerRe: how to get programmatically the selected item of a treeview dynamically built Pin
Eddy Vluggen27-Nov-17 2:21
professionalEddy Vluggen27-Nov-17 2:21 
GeneralRe: how to get programmatically the selected item of a treeview dynamically built Pin
Hervend27-Nov-17 2:56
Hervend27-Nov-17 2:56 
GeneralRe: how to get programmatically the selected item of a treeview dynamically built Pin
Eddy Vluggen27-Nov-17 3:26
professionalEddy Vluggen27-Nov-17 3:26 
GeneralRe: how to get programmatically the selected item of a treeview dynamically built Pin
Hervend27-Nov-17 19:19
Hervend27-Nov-17 19:19 
GeneralRe: how to get programmatically the selected item of a treeview dynamically built Pin
Gerry Schmitz27-Nov-17 8:12
mveGerry Schmitz27-Nov-17 8:12 
QuestionWorkaround for a virtual method call in the constructor Pin
CodeWraith25-Nov-17 9:40
CodeWraith25-Nov-17 9:40 
Questionissues concerning c# object reference not set to an instance of an object error Pin
Hervend24-Nov-17 2:27
Hervend24-Nov-17 2:27 
AnswerRe: issues concerning c# object reference not set to an instance of an object error Pin
Eddy Vluggen24-Nov-17 2:49
professionalEddy Vluggen24-Nov-17 2:49 
GeneralRe: issues concerning c# object reference not set to an instance of an object error Pin
Hervend24-Nov-17 3:25
Hervend24-Nov-17 3:25 
GeneralRe: issues concerning c# object reference not set to an instance of an object error Pin
Eddy Vluggen24-Nov-17 3:33
professionalEddy Vluggen24-Nov-17 3:33 
GeneralRe: issues concerning c# object reference not set to an instance of an object error Pin
Hervend24-Nov-17 4:24
Hervend24-Nov-17 4:24 
GeneralRe: issues concerning c# object reference not set to an instance of an object error Pin
Hervend24-Nov-17 4:35
Hervend24-Nov-17 4:35 
GeneralRe: issues concerning c# object reference not set to an instance of an object error Pin
Eddy Vluggen24-Nov-17 5:15
professionalEddy Vluggen24-Nov-17 5:15 
AnswerRe: issues concerning c# object reference not set to an instance of an object error Pin
OriginalGriff24-Nov-17 3:11
mveOriginalGriff24-Nov-17 3:11 

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.