| | |
Help with my login script :(
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2009
Posts: 6
Reputation:
Solved Threads: 0
Here is the code first off all for the login script (HTML)
Here is the behind code to that page double click on the button and get this code (VB.NET)
The problem is that when i type in the correct username and password from the database it just keeps saying "wrong password" ive tried a number of diffrent querys but im unable to fix it
Thanks for your help!
ASP.NET Syntax (Toggle Plain Text)
<form id="form1" runat="server" method="post"> <asp:TextBox ID="txtUsername" runat="server"></asp:TextBox> <asp:TextBox ID="txtPassword" runat="server" style="width: 128px"></asp:TextBox> <asp:Button ID="Button1" runat="server" Text="Login" />
Here is the behind code to that page double click on the button and get this code (VB.NET)
ASP.NET Syntax (Toggle Plain Text)
Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & Server.MapPath("database\UsersPasswords.mdb")) Try Dim query As New OleDbCommand("SELECT COUNT(*) AS Result, Username AS UsernameInput, [Password] AS PasswordInput FROM(UsersPasswords)GROUP BY Username, [Password]HAVING (COUNT(*) = 1) AND (Username = '" & txtUsername.Text & "') AND ([Password] = '" & txtPassword.Text & "')", conn) conn.Open() Dim datareader As OleDbDataReader = query.ExecuteReader() datareader.Read() If datareader.Read = True Then Label1.Text = ("You are logged in") Else Label1.Text = ("Wrong Username or Password") End If conn.Close() Catch ex As Exception Label1.Text = (ex.Message) End Try End Sub
The problem is that when i type in the correct username and password from the database it just keeps saying "wrong password" ive tried a number of diffrent querys but im unable to fix it

Thanks for your help!
This is not A Correct Approach for a login. This is simple you are Suppose to count the Records that matches the Where Clause and you have included having and Group by clause and that is incorrect. You need a simple statement like this
I Have once gave someone an answer , please search any post by me here on the Forum
ASP.NET Syntax (Toggle Plain Text)
SELECT COUNT(*) FROM UsersPasswords WHERE Username = [USERNAMEPARAMER] AND Password =[PASSWORDPARAMTER]
I Have once gave someone an answer , please search any post by me here on the Forum
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
Look at this Post and tell me if there is still a problem
http://www.daniweb.com/forums/thread138587.html
Kind Regards
Vuyiswa Maseko
http://www.daniweb.com/forums/thread138587.html
Kind Regards
Vuyiswa Maseko
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
•
•
•
•
Here is the code first off all for the login script (HTML)
ASP.NET Syntax (Toggle Plain Text)
<form id="form1" runat="server" method="post"> <asp:TextBox ID="txtUsername" runat="server"></asp:TextBox> <asp:TextBox ID="txtPassword" runat="server" style="width: 128px"></asp:TextBox> <asp:Button ID="Button1" runat="server" Text="Login" />
Here is the behind code to that page double click on the button and get this code (VB.NET)
Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & Server.MapPath("database\UsersPasswords.mdb")) Try Dim query As New OleDbCommand("SELECT COUNT(*) AS Result, Username AS UsernameInput, [Password] AS PasswordInput FROM(UsersPasswords)GROUP BY Username, [Password]HAVING (COUNT(*) = 1) AND (Username = '" & txtUsername.Text & "') AND ([Password] = '" & txtPassword.Text & "')", conn) conn.Open() Dim datareader As OleDbDataReader = query.ExecuteReader() datareader.Read() If datareader.Read = True Then Label1.Text = ("You are logged in") Else Label1.Text = ("Wrong Username or Password") End If conn.Close() Catch ex As Exception Label1.Text = (ex.Message) End Try End Sub
The problem is that when i type in the correct username and password from the database it just keeps saying "wrong password" ive tried a number of diffrent querys but im unable to fix it
Thanks for your help!
•
•
Join Date: Oct 2009
Posts: 1
Reputation:
Solved Threads: 0
0
#6 Oct 7th, 2009
U should try this simple query as
dim aurery as oledbcommand=new oledbcommad("select * from <tablename> where username='" & txtuname.text & "' and password='" & txtpasword.text & "')"
dim dr as oledbdatareader=query.executereader()
if dr.read=true then
label1.text="you r welcome"
else
label1.text="wrong pasword"
end if
Enjoy coding..
u can direct contact me on imteyazahmad86@gmail.com
u r alwz welcome
dim aurery as oledbcommand=new oledbcommad("select * from <tablename> where username='" & txtuname.text & "' and password='" & txtpasword.text & "')"
dim dr as oledbdatareader=query.executereader()
if dr.read=true then
label1.text="you r welcome"
else
label1.text="wrong pasword"
end if
Enjoy coding..
u can direct contact me on imteyazahmad86@gmail.com
u r alwz welcome
![]() |
Similar Threads
- Code Snippet: PHP Login Script (PHP)
- login script not checking password (PHP)
- Secure PHP Login Script (PHP)
- very simple login script (checking 2 variables before writing cookie) (PHP)
- login script is not working (PHP)
- Trying to create a login system (PHP)
- login script using sessions (PHP)
Other Threads in the ASP.NET Forum
- Previous Thread: Diff b/w Controls
- Next Thread: VS 2008 help
| Thread Tools | Search this Thread |
.net 2.0 activexcontrol advice ajax alltypeofvideos asp asp.net bc30451 bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn checkbox click commonfunctions compatible confirmationcodegeneration content contenttype courier css dataaccesslayer database datagridview datagridviewcheckbox datalist deadlock development dgv dropdownlist dropdownmenu dynamically edit expose fill flash flv formatdecimal forms formview gridview homeedition iframe iis javascript jquery listbox login menu microsoft mono mouse mssql multistepregistration news numerical objects opera order panelmasterpagebuttoncontrols radio ratings registration reportemail rotatepage save schoolproject search security serializesmo.table silverlight smartcard smoobjects software sql-server sqlserver2005 suse textbox tracking unauthorized validation vb.net video videos virtualdirectory vista visual-studio visualstudio web webapplications webarchitecture webdevelopemnt webprogramming webservice xml xsl youareanotmemberofthedebuggerusers





