Click here to Skip to main content
15,915,513 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: sql question Pin
metallica_rock1017-Aug-08 23:35
metallica_rock1017-Aug-08 23:35 
Questiongrid view in asp.net using c# Pin
UD(IA)15-Aug-08 3:33
UD(IA)15-Aug-08 3:33 
AnswerRe: grid view in asp.net using c# Pin
Rutvik Dave15-Aug-08 4:06
professionalRutvik Dave15-Aug-08 4:06 
Questionpick and show starting text in asp.net from database Pin
dream_liner_7e715-Aug-08 3:32
dream_liner_7e715-Aug-08 3:32 
AnswerRe: pick and show starting text in asp.net from database Pin
eyeseetee15-Aug-08 3:35
eyeseetee15-Aug-08 3:35 
AnswerRe: pick and show starting text in asp.net from database Pin
Rutvik Dave15-Aug-08 4:18
professionalRutvik Dave15-Aug-08 4:18 
QuestionSystem.InvalidOperationException : Please help Pin
AprNgp15-Aug-08 2:36
AprNgp15-Aug-08 2:36 
AnswerRe: System.InvalidOperationException : Please help Pin
Rutvik Dave15-Aug-08 4:27
professionalRutvik Dave15-Aug-08 4:27 
I think it is showing you the error because you forgot to call Read()
also your query returns only UserID and you are reading whole row.

so change the
Select UserID FROM Members WHERE UserName=@username 
to
Select UserID,FirstName,LastName,CityId,CountryId,Mood FROM Members WHERE UserName=@username


in the LoadFromReader()

public void LoadFromReader(SqlDataReader reader)    
{        
 if(reader.Read())
   {
     this.UserId = (int)reader["UserId"];        
     this.FirstName = (string)reader["FirstName"];        
     this.LastName = (string)reader["LastName"];        
     this.CityId = (int)reader["CityId"];        
     this.CountryId = (int)reader["CountryId"];        
     this.Mood = (byte)reader["Mood"];    
   }
else
  // code for no row found for the specific user...
}



also change the ExecuteScalar() to ExecuteReader()

because now you are getting more than one values.
GeneralRe: System.InvalidOperationException : Please help Pin
AprNgp15-Aug-08 5:35
AprNgp15-Aug-08 5:35 
GeneralRe: System.InvalidOperationException : Please help Pin
AprNgp15-Aug-08 7:44
AprNgp15-Aug-08 7:44 
Question'The underlying connection was closed: The connection was closed unexpectedly.' Error Pin
pubududilena15-Aug-08 1:15
pubududilena15-Aug-08 1:15 
AnswerRe: 'The underlying connection was closed: The connection was closed unexpectedly.' Error Pin
AhsanS15-Aug-08 1:18
AhsanS15-Aug-08 1:18 
GeneralRe: 'The underlying connection was closed: The connection was closed unexpectedly.' Error Pin
pubududilena15-Aug-08 1:31
pubududilena15-Aug-08 1:31 
GeneralRe: 'The underlying connection was closed: The connection was closed unexpectedly.' Error Pin
AhsanS15-Aug-08 1:44
AhsanS15-Aug-08 1:44 
Questionusing javascript frameworks with Asp.Net Pin
Boro_Bob15-Aug-08 1:08
Boro_Bob15-Aug-08 1:08 
AnswerRe: using javascript frameworks with Asp.Net Pin
RichardGrimmer15-Aug-08 4:39
RichardGrimmer15-Aug-08 4:39 
QuestionUsing "aspnet_regiis.exe -ga" on the basis of SID instead of "user name" Pin
Mushtaque Nizamani15-Aug-08 0:19
Mushtaque Nizamani15-Aug-08 0:19 
QuestionSSL Pin
mehrdadc4815-Aug-08 0:12
mehrdadc4815-Aug-08 0:12 
AnswerRe: SSL Pin
Manas Bhardwaj15-Aug-08 0:18
professionalManas Bhardwaj15-Aug-08 0:18 
GeneralRe: SSL Pin
mehrdadc4815-Aug-08 0:25
mehrdadc4815-Aug-08 0:25 
GeneralRe: SSL Pin
AhsanS15-Aug-08 0:37
AhsanS15-Aug-08 0:37 
GeneralRe: SSL Pin
eyeseetee15-Aug-08 0:41
eyeseetee15-Aug-08 0:41 
AnswerRe: SSL Pin
N a v a n e e t h15-Aug-08 6:11
N a v a n e e t h15-Aug-08 6:11 
AnswerRe: SSL Pin
JimmyRopes16-Aug-08 7:40
professionalJimmyRopes16-Aug-08 7:40 
QuestionDifficulty Using ObjectDataSource Pin
mrkeivan14-Aug-08 23:56
mrkeivan14-Aug-08 23:56 

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.