Click here to Skip to main content
15,895,709 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Sintax problem Pin
Christian Graus15-Nov-09 19:41
protectorChristian Graus15-Nov-09 19:41 
GeneralRe: Sintax problem Pin
Christian Graus15-Nov-09 19:38
protectorChristian Graus15-Nov-09 19:38 
Questionbinding an arraylist to datalist and implement pagination in Presentation Layer [modified] Pin
uglyeyes15-Nov-09 12:16
uglyeyes15-Nov-09 12:16 
AnswerRe: binding an arraylist to datalist and implement pagination in Presentation Layer Pin
Abhishek Sur15-Nov-09 12:29
professionalAbhishek Sur15-Nov-09 12:29 
GeneralRe: binding an arraylist to datalist and implement pagination in Presentation Layer Pin
uglyeyes15-Nov-09 13:15
uglyeyes15-Nov-09 13:15 
GeneralRe: binding an arraylist to datalist and implement pagination in Presentation Layer Pin
Abhishek Sur15-Nov-09 21:15
professionalAbhishek Sur15-Nov-09 21:15 
AnswerRe: binding an arraylist to datalist and implement pagination in Presentation Layer Pin
Not Active15-Nov-09 12:32
mentorNot Active15-Nov-09 12:32 
QuestionLogin problem with ExecuteScalar(); Pin
Maxdd 715-Nov-09 11:09
Maxdd 715-Nov-09 11:09 
My users table is that:

CREATE TABLE Users(
ID_Users INT IDENTITY(1,1),
Username VARCHAR(30) UNIQUE,
Password VARCHAR(100) DEFAULT 'password',
Nivel tinyint DEFAULT '3',
PRIMARY KEY(ID_Users));


When users give username and password executes the following code:

string sqlUserName;
       sqlUserName = "SELECT ID_Users, Username,Password,Nivel FROM Users ";
       sqlUserName += " WHERE (Username ='" + UserName + "')";
       sqlUserName += " AND (Password ='" + Password + "')";
       SqlCommand com = new SqlCommand(sqlUserName, Conn);

string existe;
       existe = (string)com.ExecuteScalar();

if (existe != null)
(...)


The problem is, I added five minutes ago "SELECT ID_Users". Now I have the error: "unable to cast int32 to string".

I dont understand, because I use sucessfuly tinyint and there is no problem. Ok, its not a int32, but in the end its not the same thing? What should I do ?

EDIT: looks like if I do:

object existe;
existe = com.ExecuteScalar();

There's no error. Can I use it with no problem's ?
AnswerRe: Login problem with ExecuteScalar(); Pin
Abhishek Sur15-Nov-09 11:31
professionalAbhishek Sur15-Nov-09 11:31 
GeneralRe: Login problem with ExecuteScalar(); Pin
Not Active15-Nov-09 12:01
mentorNot Active15-Nov-09 12:01 
GeneralRe: Login problem with ExecuteScalar(); Pin
Abhishek Sur15-Nov-09 12:05
professionalAbhishek Sur15-Nov-09 12:05 
GeneralRe: Login problem with ExecuteScalar(); Pin
Not Active15-Nov-09 12:30
mentorNot Active15-Nov-09 12:30 
GeneralRe: Login problem with ExecuteScalar(); Pin
Maxdd 715-Nov-09 12:21
Maxdd 715-Nov-09 12:21 
GeneralRe: Login problem with ExecuteScalar(); Pin
Abhishek Sur15-Nov-09 12:24
professionalAbhishek Sur15-Nov-09 12:24 
GeneralRe: Login problem with ExecuteScalar(); Pin
Not Active15-Nov-09 12:26
mentorNot Active15-Nov-09 12:26 
GeneralRe: Login problem with ExecuteScalar(); Pin
Maxdd 715-Nov-09 12:33
Maxdd 715-Nov-09 12:33 
AnswerRe: Login problem with ExecuteScalar(); Pin
Not Active15-Nov-09 12:04
mentorNot Active15-Nov-09 12:04 
GeneralRe: Login problem with ExecuteScalar(); Pin
Abhishek Sur15-Nov-09 12:08
professionalAbhishek Sur15-Nov-09 12:08 
AnswerRe: Login problem with ExecuteScalar(); Pin
Christian Graus15-Nov-09 17:28
protectorChristian Graus15-Nov-09 17:28 
QuestionAccesing control value in GridView on postback Pin
Aftab Sindhi15-Nov-09 5:07
Aftab Sindhi15-Nov-09 5:07 
AnswerRe: Accesing control value in GridView on postback Pin
Suresh Pirsquare15-Nov-09 7:04
Suresh Pirsquare15-Nov-09 7:04 
Questionhttp request and web request Pin
noo.dyab15-Nov-09 5:07
noo.dyab15-Nov-09 5:07 
AnswerRe: http request and web request Pin
Abhishek Sur15-Nov-09 6:16
professionalAbhishek Sur15-Nov-09 6:16 
Questioncan we store viewstate in masterpage? Pin
Suresh Pirsquare14-Nov-09 19:31
Suresh Pirsquare14-Nov-09 19:31 
AnswerRe: can we store viewstate in masterpage? Pin
Abhijit Jana14-Nov-09 19:55
professionalAbhijit Jana14-Nov-09 19:55 

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.