473,467 Members | 1,446 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Vb Login ....

15 New Member
Hi ..

I have a table which has user records and some other user details..table name is userdetails.

My first page when the program runs is login. If the user enters right username..i.e existing username and its valid password ctrl moves to next page of execution. Orelse it shoud indicate that user/password isnt existing. only existing users can login.
My frontend is vb6 and backend is oracle.
I have two txt boxes and 2 cmds. text1 is for username and text2 for password. and commands for login and cancel.

please help me out people. its urgent..

Thanks in advance.
Oct 1 '07 #1
12 2783
debasisdas
8,127 Recognized Expert Expert
Check if the user name and corresponding passsword exists in your database or notusing count. Try to use SQL for the purpose.

if it is 1 then proceed.
Oct 1 '07 #2
shreshta
15 New Member
sorry i couldnt get u.. i have the username in that table userdetails. i need to verify whether the user has entered the username which is in userdetails table. thats wat i meant by existign user. userid and password and other detials of user is present in userdetails.

loginname shoudl be existing username of that table.and each user has a password which is aslo in that table.
Oct 1 '07 #3
hariharanmca
1,977 Top Contributor
try this Query.
Expand|Select|Wrap|Line Numbers
  1. strSql = "Select * from tblUserDetails where fldUserName like '" & txtUserName.Text & "' and fldPassword like '" & txtPassword.Text & "'"
Oct 1 '07 #4
shreshta
15 New Member
I tried that qry but control goes to else part. i gave the above string in if part and if it is correct then ctrl goes to next page or if it is not correct then will have to try to login again.. msg invalid user/password is displayed.

for me when i tried the above qry ctrl goes to else part and says invalid user/password though the user and password exists.
Oct 1 '07 #5
shreshta
15 New Member
If strsql = "Select * from tblUserDetails where fldUserName like '" & txtUserName.Text & "' and fldPassword like '" & txtPassword.Text & "'" Then
LoginSucceeded = True
MsgBox "login succeded"
Me.Hide
Form1.Show

This is the code i used.
Oct 1 '07 #6
Ali Rizwan
925 Contributor
Hi ..

I have a table which has user records and some other user details..table name is userdetails.

My first page when the program runs is login. If the user enters right username..i.e existing username and its valid password ctrl moves to next page of execution. Orelse it shoud indicate that user/password isnt existing. only existing users can login.
My frontend is vb6 and backend is oracle.
I have two txt boxes and 2 cmds. text1 is for username and text2 for password. and commands for login and cancel.

please help me out people. its urgent..

Thanks in advance.
If you dont want to save your passsword to a database then save you password and login name to a regidtery value. Its too much secure(i think)
GOODLUCK
ALI
Oct 1 '07 #7
jrtox
89 New Member
If strsql = "Select * from tblUserDetails where fldUserName like '" & txtUserName.Text & "' and fldPassword like '" & txtPassword.Text & "'" Then
LoginSucceeded = True
MsgBox "login succeded"
Me.Hide
Form1.Show

This is the code i used.
Let see, are you Using ADODC Object OR ADODB?

1. if your Using ADODC Object then try this one.
'First Establish ADodc's Connection to your database.

'Second
strsql = "Select * from tblUserDetails where fldUserName like '" & txtUserName.Text & "' and fldPassword like '" & txtPassword.Text & "'"

Adodc1.CommandType = adCmdText
Adodc1.RecordSource = strsql
Adodc1.refresh

If Not Adodc1.Recordset.EOF Then
LoginSucceeded = True
MsgBox "login succeded"
Me.Hide
Form1.Show
else
Msgbox "Invalid UserName/Password"
End If

2. IF your Using ADODB


strsql = "Select * from tblUserDetails where fldUserName like '" & txtUserName.Text & "' and fldPassword like '" & txtPassword.Text & "'"

RS.Open strsql,ConnectionString,,,

If Not RS.EOF Then
LoginSucceeded = True
MsgBox "login succeded"
Me.Hide
Form1.Show
else
Msgbox "Invalid UserName/Password"
End If

Regards
Ervin
Oct 2 '07 #8
creative1
274 Contributor
You can also try this

P.S using Adodb

Set RS = New ADODB.Recordset
RS.Open ("Select * from tblUserDetails Where fldUserName= " & txtUserName.Text & " "), Conn, adOpenStatic, adLockOptimistic, adCmdText

If txtpass.Text <> RS.Fields("fldUserName") Then
Call MsgBox("Invalid username", vbInformation, "Error!")
txtUserName.Text = ""
txtPassword.Text = ""
txtUserName.SetFocus
Exit Sub
elseIf txtPassword.Text<> RS.Fields("fldPassword") Then
Call MsgBox("Invalid password", vbInformation, "Error!")
txtUserName.Text= ""
txtPassword.SetFocus
Exit Sub
Else
' you next step

end if

good luck

Farhana
Oct 2 '07 #9
shreshta
15 New Member
Thank you friends.. It worked. So i am able to login.. I need one more help. This is also a bit urgent. In fact i need within tonight.

The username i use to login should be set to another variable in another module which is declared globally. How to do this. consider that global variable to be g_USERNAME

Thanks in advance..Hope to get help from you people within tonight.
Oct 2 '07 #10
creative1
274 Contributor
its simple
after sucessful login write this line .

g_USERNAME=txtUserName.Text
regards
Oct 2 '07 #11
jamesd0142
469 Contributor
This might not be appropriate.

I would use some sort of encryption so when the user enters a password your program encrypts the password then matches it against the encrypted password in the database, then if someone gained access to your database they would still need your program to work out what the password is.

Also, this could you a text file because each time a password is added to the file via the program it will be encrypted and any1 lookin at the file sees a load of imformation thats no goo to them.
Oct 3 '07 #12
debasisdas
8,127 Recognized Expert Expert
try this Query.
Expand|Select|Wrap|Line Numbers
  1. strSql = "Select * from tblUserDetails where fldUserName like '" & txtUserName.Text & "' and fldPassword like '" & txtPassword.Text & "'"
Why to use like in the SQL statment for searching the database table?
Oct 3 '07 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: koolyio | last post by:
Hey, could you please tell me what is wrong with my login script. I just started learning php. CODE: login.php <? session_start(); header("Cache-Control: private"); ?>
5
by: Simon | last post by:
Hi, I have a Login.php page that logs the user in and out. I has two forms within the page, (depending on what we are trying to do), either one to log in or out. The form calls itself using a...
1
by: Tom Jones | last post by:
Hi, I am using the HttpWebRequest and HttpWebResponse classes to pull information from a web server on the internet. I have an account on one of the webservers that I need to log into...
2
by: Beginner | last post by:
I know this is an old question, but searching all over the internet plus several MS security conferences, still haven't got a straight anwser. Basically, the login.aspx is on one dedicated server...
4
by: nicholas | last post by:
Hi, Got an asp.net application and I use the "forms" authentication mode defined in the web.config file. Everything works fine. But now I would like to add a second, different login page for...
2
by: IdleBrain | last post by:
Hello All: I used a Login control to authenticate a user to login. The problem is that when I login with good username & password, the login view would say that the login was successful. But...
6
by: AppleBag | last post by:
I'm having the worst time trying to login to myspace through code. Can someone tell me how to do this? Please try it yourself before replying, only because I have asked this a couple of times in...
4
tolkienarda
by: tolkienarda | last post by:
Hi all I work for a small webdesign company and we have remote hosting. i built a mysql database with phpmyadmin on the server. i then downloaded and modified a php login page. i am continuing to...
3
by: satishknight | last post by:
Hi, Can some one tell me how to change the validation sequence for the code pasted below, actually what I want it when any one enters the wrong login information (already registered users) then it...
13
by: Apostle | last post by:
Hi all, after thinking for sometimes, I thought it will be great opportunity to learn if I will start from scratch and build my own register/login system. Here is the thread that I will be posting...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.