473,395 Members | 1,412 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Vb Login ....

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 2777
debasisdas
8,127 Expert 4TB
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
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 1GB
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
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
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 512MB
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
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 100+
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
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 100+
its simple
after sucessful login write this line .

g_USERNAME=txtUserName.Text
regards
Oct 2 '07 #11
jamesd0142
469 256MB
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 Expert 4TB
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.