Click here to Skip to main content
15,891,375 members
Home / Discussions / C#
   

C#

 
AnswerRe: Simple helper class for DateTime? Pin
Garth J Lancaster11-Mar-13 13:13
professionalGarth J Lancaster11-Mar-13 13:13 
AnswerRe: Simple helper class for DateTime? Pin
Dave Kreskowiak11-Mar-13 13:22
mveDave Kreskowiak11-Mar-13 13:22 
GeneralRe: Simple helper class for DateTime? Pin
Goaty6510911-Mar-13 13:41
Goaty6510911-Mar-13 13:41 
AnswerRe: Simple helper class for DateTime? Pin
DaveyM6911-Mar-13 13:41
professionalDaveyM6911-Mar-13 13:41 
GeneralRe: Simple helper class for DateTime? Pin
Goaty6510911-Mar-13 13:50
Goaty6510911-Mar-13 13:50 
GeneralRe: Simple helper class for DateTime? Pin
DaveyM6911-Mar-13 13:52
professionalDaveyM6911-Mar-13 13:52 
GeneralRe: Simple helper class for DateTime? Pin
Goaty6510911-Mar-13 13:59
Goaty6510911-Mar-13 13:59 
GeneralRe: Simple helper class for DateTime? Pin
DaveyM6911-Mar-13 14:04
professionalDaveyM6911-Mar-13 14:04 
AnswerRe: Simple helper class for DateTime? Pin
V.11-Mar-13 23:11
professionalV.11-Mar-13 23:11 
QuestionWCF Method that takes an object as its parameter Pin
David Chen11-Mar-13 11:47
David Chen11-Mar-13 11:47 
Questionupdating MS database using c#.net Pin
Eng.almasrouhi11-Mar-13 10:12
Eng.almasrouhi11-Mar-13 10:12 
AnswerRe: updating MS database using c#.net Pin
jschell11-Mar-13 10:57
jschell11-Mar-13 10:57 
GeneralRe: updating MS database using c#.net Pin
Eng.almasrouhi11-Mar-13 11:26
Eng.almasrouhi11-Mar-13 11:26 
GeneralRe: updating MS database using c#.net Pin
NotPolitcallyCorrect11-Mar-13 11:45
NotPolitcallyCorrect11-Mar-13 11:45 
GeneralRe: updating MS database using c#.net Pin
Eng.almasrouhi11-Mar-13 12:09
Eng.almasrouhi11-Mar-13 12:09 
GeneralRe: updating MS database using c#.net Pin
NotPolitcallyCorrect11-Mar-13 14:07
NotPolitcallyCorrect11-Mar-13 14:07 
JokeRe: updating MS database using c#.net Pin
Eddy Vluggen11-Mar-13 11:48
professionalEddy Vluggen11-Mar-13 11:48 
GeneralRe: updating MS database using c#.net Pin
Eng.almasrouhi11-Mar-13 12:13
Eng.almasrouhi11-Mar-13 12:13 
AnswerRe: updating MS database using c#.net Pin
jschell12-Mar-13 9:21
jschell12-Mar-13 9:21 
Questionerror with update query Pin
User349011-Mar-13 9:23
User349011-Mar-13 9:23 
AnswerRe: error with update query Pin
vanikanc11-Mar-13 9:31
vanikanc11-Mar-13 9:31 
GeneralRe: error with update query Pin
User349011-Mar-13 9:36
User349011-Mar-13 9:36 
GeneralRe: error with update query Pin
vanikanc11-Mar-13 10:13
vanikanc11-Mar-13 10:13 
GeneralRe: error with update query Pin
susanna.floora12-Mar-13 0:11
susanna.floora12-Mar-13 0:11 
AnswerRe: error with update query Pin
Dave Kreskowiak11-Mar-13 10:12
mveDave Kreskowiak11-Mar-13 10:12 
First and foremost, you do NOT use string concatentation to built a query like that. Why? Just Google for "SQL Injection attack" and you'll find out. A big problem with what you've done is what happens if the user types a ' character in their password?? I guarantee that it'll break your code and give you the error that you're talking about.

Then you can Google for "C# SQL Parameterized queries" to find out how to do it correcly. This also has the benefit of making your code easier to debug and maintain.

Next, why are you calling .ToString() on a string?? The Text property always returns a string, so there's no need to call .ToString() on it!


And finally, with an UPDATE statement as yours, you would normally use ExecuteScalar, no ExecuteReader, to launch it.

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.