Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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
  #1 (permalink)  
Old August 11th, 2004, 11:38 AM
Authorized User
 
Join Date: Jul 2004
Location: St. John\'s, NL, Canada.
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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


  #2 (permalink)  
Old August 11th, 2004, 11:52 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

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
  #3 (permalink)  
Old August 11th, 2004, 12:44 PM
Authorized User
 
Join Date: Jul 2004
Location: St. John\'s, NL, Canada.
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

  #4 (permalink)  
Old August 11th, 2004, 01:23 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

I think it's saying it can't find the username 'mrideout'.



  #5 (permalink)  
Old August 11th, 2004, 01:50 PM
Authorized User
 
Join Date: Jul 2004
Location: St. John\'s, NL, Canada.
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

  #6 (permalink)  
Old August 11th, 2004, 03:57 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

Put quotes around it, it should appear as:

Where Username = 'mrideout'

So, DO:

.. where Username = '" & strUsername & "'"

Try that,

Brian
  #7 (permalink)  
Old August 12th, 2004, 10:11 AM
Authorized User
 
Join Date: Jul 2004
Location: St. John\'s, NL, Canada.
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks I have it working now.



Similar Threads
Thread Thread Starter Forum Replies Last Post
on the click of a button how to load another form? amit_mande@yahoo.com VB.NET 2 September 12th, 2006 06:53 AM
Is it possible to button click Y/N in an email and kenn_rosie VB.NET 2002/2003 Basics 0 March 2nd, 2006 07:36 PM
Button Click ~Bean~ ASP.NET 1.0 and 1.1 Basics 2 September 27th, 2005 09:32 AM
Print on Button Click mahulda ASP.NET 1.0 and 1.1 Basics 2 August 5th, 2004 02:50 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.