Click here to Skip to main content
15,904,288 members
Home / Discussions / C#
   

C#

 
QuestionRe: Queuebuilding. [modified] Pin
Angelinna6-Aug-08 9:38
Angelinna6-Aug-08 9:38 
QuestionEdit a resource file runtime Pin
vaibhav.jape@gmail.com5-Aug-08 18:12
vaibhav.jape@gmail.com5-Aug-08 18:12 
QuestionLogOff computer by code Pin
H.R5-Aug-08 17:52
H.R5-Aug-08 17:52 
AnswerRe: LogOff computer by code Pin
John_Adams5-Aug-08 18:23
John_Adams5-Aug-08 18:23 
Questionlogin eror The 'Microsoft.Jet.OLEDB.4.0Data Source=C:\Documents and Settings\13861957\Desktop\logindb2.mdb' provider is not registered on the local machine. Pin
eQyZ5-Aug-08 17:48
eQyZ5-Aug-08 17:48 
AnswerRe: login eror The 'Microsoft.Jet.OLEDB.4.0Data Source=C:\Documents and Settings\13861957\Desktop\logindb2.mdb' provider is not registered on the local machine. Pin
PIEBALDconsult5-Aug-08 18:08
mvePIEBALDconsult5-Aug-08 18:08 
Questionlogin box error ( Syntax error in string in query expression 'UserName= 'student Password = 'password) Pin
Arif Liminto5-Aug-08 17:46
professionalArif Liminto5-Aug-08 17:46 
AnswerRe: login box error ( Syntax error in string in query expression 'UserName= 'student Password = 'password) Pin
PIEBALDconsult5-Aug-08 18:05
mvePIEBALDconsult5-Aug-08 18:05 
A) You left out the apostrophes.

B) You left out the AND.

C) Don't do it that way; use parameters:

cmd.CommandText = "SELECT Username, Password FROM logindatabase WHERE UserName=@username and Password=@password" ;
cmd.Parameters.Add ( "@username" , username ) ;
cmd.Parameters.Add ( "@password" , password ) ;


Access and the Jet Engine will allow named parameters, but they need to be in the same order as in the statement.


D) Why return the username and password? Why not a COUNT(*) or the user's ID or something? Returning a single value with ExecuteScalar is likely to be quicker.

E) I prefer not to use concatenation to split long strings of SQL; I use verbatim strings (note the @):

cmd.CommandText = 
@"
SELECT Username
,Password
FROM logindatabase
WHERE UserName=@username
and Password=@password
" ;


And why do so many people use a separate local string variable? Confused | :confused:

F) Are you storing the plain-text password? I suggest using at least a hash of the password.
AnswerRe: login box error ( Syntax error in string in query expression 'UserName= 'student Password = 'password) Pin
Arif Liminto6-Aug-08 2:52
professionalArif Liminto6-Aug-08 2:52 
QuestionError accessing dll through the process, running under "Network Service" user . Pin
fulbright5-Aug-08 17:42
fulbright5-Aug-08 17:42 
Questionfind control Pin
Shine Tyler5-Aug-08 17:39
Shine Tyler5-Aug-08 17:39 
AnswerRe: find control Pin
Paul Conrad5-Aug-08 19:26
professionalPaul Conrad5-Aug-08 19:26 
QuestionWebRequest.Proxy Pin
George_George5-Aug-08 16:10
George_George5-Aug-08 16:10 
AnswerRe: WebRequest.Proxy Pin
jkersch5-Aug-08 21:38
jkersch5-Aug-08 21:38 
GeneralRe: WebRequest.Proxy Pin
George_George5-Aug-08 21:41
George_George5-Aug-08 21:41 
Questionnamespace of WCF Pin
George_George5-Aug-08 16:01
George_George5-Aug-08 16:01 
AnswerRe: namespace of WCF Pin
jkersch5-Aug-08 21:09
jkersch5-Aug-08 21:09 
GeneralRe: namespace of WCF Pin
George_George5-Aug-08 21:21
George_George5-Aug-08 21:21 
GeneralRe: namespace of WCF Pin
jkersch5-Aug-08 21:38
jkersch5-Aug-08 21:38 
GeneralRe: namespace of WCF Pin
George_George5-Aug-08 21:40
George_George5-Aug-08 21:40 
GeneralRe: namespace of WCF Pin
jkersch5-Aug-08 21:56
jkersch5-Aug-08 21:56 
GeneralRe: namespace of WCF Pin
George_George5-Aug-08 23:10
George_George5-Aug-08 23:10 
QuestionDataGridView - RowFocus Pin
nelsonpaixao5-Aug-08 12:58
nelsonpaixao5-Aug-08 12:58 
AnswerRe: DataGridView - RowFocus Pin
cocoonwls5-Aug-08 17:21
cocoonwls5-Aug-08 17:21 
GeneralRe: DataGridView - RowFocus Pin
nelsonpaixao6-Aug-08 14:19
nelsonpaixao6-Aug-08 14:19 

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.