Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #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,111
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.

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 09:15 PM.


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