Click here to Skip to main content
15,921,250 members
Home / Discussions / C#
   

C#

 
AnswerRe: Logging to Website Pin
Luc Pattyn13-Jul-10 21:43
sitebuilderLuc Pattyn13-Jul-10 21:43 
AnswerRe: Logging to Website Pin
Bigdeak13-Jul-10 22:02
Bigdeak13-Jul-10 22:02 
QuestionNeed Help Pin
mjawadkhatri13-Jul-10 20:21
mjawadkhatri13-Jul-10 20:21 
AnswerRe: Need Help Pin
OkkiePepernoot13-Jul-10 21:09
OkkiePepernoot13-Jul-10 21:09 
AnswerRe: Need Help Pin
karmjit43513-Jul-10 21:15
karmjit43513-Jul-10 21:15 
AnswerRe: Need Help Pin
OriginalGriff13-Jul-10 21:40
mveOriginalGriff13-Jul-10 21:40 
AnswerRe: Need Help Pin
Luc Pattyn13-Jul-10 21:49
sitebuilderLuc Pattyn13-Jul-10 21:49 
AnswerRe: Need Help Pin
Pete O'Hanlon13-Jul-10 22:02
mvePete O'Hanlon13-Jul-10 22:02 
There are a few things that you need to look at here.

1. You are using a query (as others have pointed out) that is wide open to SQL Injection.
2. You don't dispose of your SqlCommand (try wrapping them it the using statement).
3. You are using the wrong method to read data (and I'm surprised nobody pointed this out to you). Basically you have opened up a DataReader to read a single value out of the database. This is overkill. Try replacing this with ExecuteScalar instead, which is designed to return single values.
4. In your finally block, you call conn.Close; what happens if you didn't manage to open the connection in the first place?

"WPF has many lovers. It's a veritable porn star!" - Josh Smith

As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.


My blog | My articles | MoXAML PowerToys | Onyx



QuestionNetwork Transaction Management...... Need Help... Pin
nEar_mO13-Jul-10 16:42
nEar_mO13-Jul-10 16:42 
AnswerRe: Network Transaction Management...... Need Help... Pin
Richard Andrew x6413-Jul-10 17:33
professionalRichard Andrew x6413-Jul-10 17:33 
GeneralRe: Network Transaction Management...... Need Help... Pin
nEar_mO13-Jul-10 17:40
nEar_mO13-Jul-10 17:40 
AnswerRe: Network Transaction Management...... Need Help... Pin
Peace ON13-Jul-10 19:49
Peace ON13-Jul-10 19:49 
QuestionTrigger a Parent Form Event From UserControl In TableLayoutPanel Pin
JessStuart13-Jul-10 14:32
JessStuart13-Jul-10 14:32 
AnswerRe: Trigger a Parent Form Event From UserControl In TableLayoutPanel Pin
Richard Blythe13-Jul-10 16:12
Richard Blythe13-Jul-10 16:12 
GeneralRe: Trigger a Parent Form Event From UserControl In TableLayoutPanel Pin
JessStuart14-Jul-10 6:51
JessStuart14-Jul-10 6:51 
GeneralRe: Trigger a Parent Form Event From UserControl In TableLayoutPanel Pin
Richard Blythe14-Jul-10 7:40
Richard Blythe14-Jul-10 7:40 
GeneralRe: Trigger a Parent Form Event From UserControl In TableLayoutPanel Pin
JessStuart14-Jul-10 8:07
JessStuart14-Jul-10 8:07 
GeneralRe: Trigger a Parent Form Event From UserControl In TableLayoutPanel Pin
Richard Blythe14-Jul-10 8:28
Richard Blythe14-Jul-10 8:28 
QuestionPlaying mp3 files?? Pin
Muammar©13-Jul-10 7:11
Muammar©13-Jul-10 7:11 
AnswerRe: Playing mp3 files?? Pin
I Believe In GOD13-Jul-10 7:39
I Believe In GOD13-Jul-10 7:39 
GeneralRe: Playing mp3 files?? Pin
Muammar©13-Jul-10 10:18
Muammar©13-Jul-10 10:18 
GeneralRe: Playing mp3 files?? Pin
Muammar©13-Jul-10 10:23
Muammar©13-Jul-10 10:23 
GeneralRe: Playing mp3 files?? Pin
harold aptroot13-Jul-10 10:38
harold aptroot13-Jul-10 10:38 
GeneralRe: Playing mp3 files?? Pin
Muammar©13-Jul-10 19:22
Muammar©13-Jul-10 19:22 
GeneralRe: Playing mp3 files?? Pin
Ravi Bhavnani13-Jul-10 11:43
professionalRavi Bhavnani13-Jul-10 11:43 

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.