Click here to Skip to main content
15,919,774 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questioncast in generics List of objects Pin
papy-boom4-Jul-07 0:07
papy-boom4-Jul-07 0:07 
AnswerRe: cast in generics List of objects Pin
Pete O'Hanlon4-Jul-07 0:28
mvePete O'Hanlon4-Jul-07 0:28 
QuestionRusty Coder Needs Help Pin
munklefish4-Jul-07 0:06
munklefish4-Jul-07 0:06 
AnswerRe: Rusty Coder Needs Help Pin
Urs Enzler4-Jul-07 0:22
Urs Enzler4-Jul-07 0:22 
GeneralRe: Rusty Coder Needs Help Pin
munklefish4-Jul-07 0:31
munklefish4-Jul-07 0:31 
Questionform authentication Pin
24891284-Jul-07 0:05
24891284-Jul-07 0:05 
QuestionProblem with SqlDataReader Pin
netwizerd4-Jul-07 0:01
netwizerd4-Jul-07 0:01 
AnswerRe: Problem with SqlDataReader Pin
Colin Angus Mackay4-Jul-07 0:09
Colin Angus Mackay4-Jul-07 0:09 
netwizerd wrote:
cmd.CommandText = "SELECT * FROM users WHERE username='"+Username.Value+"' AND password= '"+Password.Value+"'";

// Fill our parameters
cmd.Parameters.Add("@username", SqlDbType.NVarChar, 64).Value = Username.Value;
cmd.Parameters.Add("@password", SqlDbType.NVarChar, 128).Value = Password.Value; // Or "sha1"


Fill out what parameters? You aren't using any parameters in the SELECT statement.

To use the parameters you should write:
cmd.CommandText = "SELECT * FROM users WHERE username=@username AND password=@password";



netwizerd wrote:
I am not getting any result from reader.Read();


Perhaps the data does not exist. Or...

netwizerd wrote:
reader.GetString(0), // User-data, in this case the roles


The first column isn't the roles. You've used SELECT * so in fact you don't know which column will be the roles because the columns will be returned in what ever order SQL Server decides is most efficient. You must use SELECT roles to ensure that the roles column is the first one.

By the way - for security you should also consider using a salted hash for storing passwords.



Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...

"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."

Ready to Give up - Your help will be much appreciated.


My website

GeneralRe: Problem with SqlDataReader Pin
netwizerd4-Jul-07 2:50
netwizerd4-Jul-07 2:50 
GeneralRe: Problem with SqlDataReader Pin
Colin Angus Mackay4-Jul-07 3:17
Colin Angus Mackay4-Jul-07 3:17 
GeneralI give up! Pin
Colin Angus Mackay4-Jul-07 3:11
Colin Angus Mackay4-Jul-07 3:11 
GeneralRe: I give up! Pin
Pete O'Hanlon4-Jul-07 3:16
mvePete O'Hanlon4-Jul-07 3:16 
GeneralRe: I give up! Pin
Colin Angus Mackay4-Jul-07 3:25
Colin Angus Mackay4-Jul-07 3:25 
GeneralRe: I give up! Pin
Pete O'Hanlon4-Jul-07 3:38
mvePete O'Hanlon4-Jul-07 3:38 
GeneralRe: I give up! Pin
Pete O'Hanlon4-Jul-07 3:54
mvePete O'Hanlon4-Jul-07 3:54 
GeneralRe: I give up! Pin
Colin Angus Mackay4-Jul-07 4:15
Colin Angus Mackay4-Jul-07 4:15 
GeneralRe: I give up! Pin
Pete O'Hanlon4-Jul-07 5:02
mvePete O'Hanlon4-Jul-07 5:02 
Questionhighlighting search terms Pin
marky7773-Jul-07 23:44
marky7773-Jul-07 23:44 
AnswerRe: highlighting search terms Pin
Pete O'Hanlon3-Jul-07 23:47
mvePete O'Hanlon3-Jul-07 23:47 
AnswerRe: highlighting search terms Pin
Pete O'Hanlon3-Jul-07 23:57
mvePete O'Hanlon3-Jul-07 23:57 
GeneralRe: highlighting search terms Pin
marky7774-Jul-07 0:10
marky7774-Jul-07 0:10 
QuestionGridview - dynamically added checkbox fields are Disabled Pin
Mohamed El Gohary3-Jul-07 23:39
Mohamed El Gohary3-Jul-07 23:39 
QuestionBinding Radio Button Control in GridView Pin
Ajeet mittal3-Jul-07 23:36
Ajeet mittal3-Jul-07 23:36 
Question'Sys' is undefined Pin
Abubakarsb3-Jul-07 23:23
Abubakarsb3-Jul-07 23:23 
AnswerRe: 'Sys' is undefined Pin
Urs Enzler3-Jul-07 23:35
Urs Enzler3-Jul-07 23: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.