 |
BOOK: Beginning ASP.NET 1.0  | This is the forum to discuss the Wrox book Beginning ASP.NET 1.0 with C# by Chris Goode, John Kauffman, Christopher L. Miller, Neil Raybould, S. Srinivasa Sivakumar, Dave Sussman, Ollie Cornes, Rob Birdwell, Matt Butler, Gary Johnson, Ajoy Krishnamoorthy, Juan T. Llibre, Chris Ullman; ISBN: 9780764543708 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning ASP.NET 1.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|
|

August 11th, 2004, 11:38 AM
|
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Login Click Button
I am using an .aspx (all HTML) on the form there is a button called btnLogin.
I the code-behind page I have a sub (below) called login_Click that verifies the username and password.
My code complies and I enter username and password, but nothing happens.
-------------------------
Private Sub login_Click()
Dim objUser As New clsUser()
Dim loginresponse As String
objUser.Username = Request.Form("txtusername")
Response.Write(objUser.Username)
loginresponse = objUser.ValidateLogin
If loginresponse = True Then
Response.Redirect("Default.aspx")
Else
Response.Write("ERROR!")
End If
End Sub
--------------------------------------------------------
Any help is appreciated.
Mark
|
|

August 11th, 2004, 11:52 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Hey,
Try:
objUser.Username = txtusername.Text
instead. This is the .NET way of doing things. In addition, could you post the ValidateLogin method of clsUser?
Brian
|
|

August 11th, 2004, 12:44 PM
|
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I have my pervious problem sorted out. However I get the following error when I clcik me login button:
-----------
System.Data.OleDb.OleDbException: No value given for one or more required parameters
-----------------------
Also here is my ValidateLogin Function:
-------------------------------------------
Function ValidateLogin() As Boolean
'Establishes database connect and Checks Username/Password
Dim strSQL, strConn As String
Dim strUsername, strPassword As String
Dim objDBComm As OleDbCommand
Dim objDBConn As OleDbConnection
Dim objUser As New clsUser()
Dim objGetConnection As New clsDBConnection()
objDBConn = objGetConnection.GetDatabaseConnection
strUsername = objUser.Username
Dim returnvalue
strSQL = "SELECT * FROM [User] WHERE Username = mrideout"
objDBComm = New OleDbCommand(strSQL, objDBConn)
returnvalue = objDBComm.ExecuteScalar()
objDBConn.Close()
If returnvalue > 1 Then
Return True
Else
Return False
End If
End Function
------------------------------------
red line in the line of code that is casing me the error.
Thanks,
Mark
|
|

August 11th, 2004, 01:23 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
I think it's saying it can't find the username 'mrideout'.
|
|

August 11th, 2004, 01:50 PM
|
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Yes you are right.
My question is now is how do I get the SQL Statement:
strSQL = "SELECT * FROM [User] WHERE Username = mrideout"
to take:
strUsername
as the where clause?
Please advise...
Thanks,
Mark
|
|

August 11th, 2004, 03:57 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Hey,
Put quotes around it, it should appear as:
Where Username = 'mrideout'
So, DO:
.. where Username = '" & strUsername & "'"
Try that,
Brian
|
|

August 12th, 2004, 10:11 AM
|
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks I have it working now.
|
|
 |