Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to create a simple login form in vb.net without a database connection???
Posted

http://stackoverflow.com/questions/2326131/login-form-using-ms-access-in-vb-net[^]

try this...:)

VB
dim conn as new oledb.oledbconnection("your connection string")
dim sqlcmdtext as string = "select count(*) from yourusertable where usernamecolumn = @user and passwordcolumn = @pass"
dim cmd as new oledb.oledbcommand(sqlcmdtext, conn)
cmd.parameters.addwithvalue("@user", enteredusername)
cmd.parameters.addwithvalue("@pass", enteredpassword)
conn.open()
dim UserFoundCount as integer = convert.toint32(cmd.executescalar())
if UserFoundCount = 1 then
  'user exists
elseif UserFoundCount = 0 then
  'user not found
elseif UserFoundCount > 1 then
  'you have more than one of the same username and password in the table
end if
conn.close()


reference :
http://social.msdn.microsoft.com/Forums/vstudio/en-US/d110890d-7993-498a-ab91-dc961341bc4c/login-form-in-vbnet-coding-to-verify-username-password-from-access-database[^]
 
Share this answer
 
v2
I am creating the form without database connection
and my code just look like this:


XML
<script runat="server">
sub Page_Load

If (txtuname.Text = "xxx") AND (txtpass.Text = "xxx") Then
response.write("Welcome user")
Server.Transfer("login2.aspx")
Else
response.write("Invalid username and password")
Server.Transfer("login.aspx")
End IF
End sub
</script>
 
Share this answer
 
 
Share this answer
 
XML
<script runat="server">
sub Page_Load
If txtuname.Text="xxx"  AND txtpass.Text="xxx" Then

response.redirect("login2.aspx")
Else

Response.write("Invalid Username And Password")
End If
End sub

</script>
 
Share this answer
 

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