Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
if my login table contain 3 records then how can i check the entered fields are valid
Posted
Comments
OriginalGriff 12-Feb-12 5:13am    
Depends on what your table contains, and what your entered fields contain.
Remember, we can't see your screen, access your HDD, or read your mind!
Use the "Improve question" widget to edit your question and provide better information.
thatraja 12-Feb-12 5:43am    
Show your code

Suppose you have the user name in txtusername.text and password in txtpassword.text

So on the OK/Login Button click event, check the following

VB
Dim rsLogin AS New ADODB.RecordSet
Set rsLogin = New ADODB.RecordSet

if (txtusername.text <> "") And (txtpassword <> "") Then
    rsLogin.Open "SELECT * FROM Login WHERE Uname = '" & txtusername.text & "' AND  password = '" & txtpassword.Text & "'"
Endif

if rsLogin.EOF = True then
    msgbox "Invalid UserName Or Password", VbCritical
    txtusername.SetFocus
Else
    msgbox "Successful Login"
Endif

Hope This Will Help You To Solve Your Problem
 
Share this answer
 
We can use LInQ code to validate the user existence as:

SQL
if (!db.Users.Any( u => u.UserName == argUser ))
{
  // Action code for valid user
}
else
{
  // Action code for in valid user
}
 
Share this answer
 
Comments
Bhags1992 12-Feb-12 5:28am    
can u give another code?i cant understant this LInQ code
Aniket Yadav 12-Feb-12 5:44am    
What Exactly You Want To Do Here? Can You Explain?
Bhags1992 12-Feb-12 5:48am    
i have login table that contain 2 fields uname nd password in that 3 records are available i want check login for ech field

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900