Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics 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
 
Old February 16th, 2007, 01:39 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there..

when you said top and bottom lines you refers to the recordset?? cause it's has eof for the last record and bof for the first one (the two of them are null)...

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
 
Old February 16th, 2007, 01:42 PM
Friend of Wrox
 
Join Date: Feb 2007
Location: Fleet, , United Kingdom.
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to neil.abachi07
Default

hi

what i mean is, for that piece of code it says "No match found, EOF is not true" and then "EOF is true, no match found"

How can EOF be true and false when no match is found? Surely that is an error?

neil

 
Old February 16th, 2007, 01:51 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

It can't. That piece of code is not in a loop so, as such, either the If statement or the else statement will execute. If the recordset is not EOF then the if portion will be evaluate if the recordset is EOF then the else statement will be evaluated. Execution inside the if does not fall through to the else statement.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
 
Old February 16th, 2007, 01:53 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

somebody makes a mistake there.. eof is true when no match is found...

and if you are getting always invalid password is because you are doing probably the wrong query..

for what i read you are programming in a notepad..

Doug any idea how he can trace the code?? maybe instead of write invalid password show the data you are searching for???

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
 
Old February 16th, 2007, 04:18 PM
Friend of Wrox
 
Join Date: Feb 2007
Location: Fleet, , United Kingdom.
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to neil.abachi07
Default

Hi,

The code used is on the first page - all i did to tweak it was change the table name and the mdb file path. otherwise, the code is as it is on page 1. even if a write or response was used, why is it that there is an invalid password response every time? i have looked at the code and im definate that it references the right tables and cells within.

Neil

 
Old February 16th, 2007, 04:24 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Oh god, how I wish tracing was available in Classic >< Sadly, no, no tracing is available to you. I would suggest doing: Response.Write(sql) does this show the correct SQL Statement? Better yet if you execute it in Access does it return anything?

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
 
Old February 16th, 2007, 04:39 PM
Friend of Wrox
 
Join Date: Feb 2007
Location: Fleet, , United Kingdom.
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to neil.abachi07
Default

sorry, not sure what you are asking for once i change the statement

neil

 
Old February 16th, 2007, 04:43 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Replace this line:
set rec=Con.execute(sql)

with
Response.Write(sql)

This will write out the sqlStatement you are passing into Access. Is it the statement you expect to be sending in?

Also consider changing this:
  Dim Con, sql, rec
   set Con = Server.CreateObject("ADODB.Connection")
  Con.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("database.mdb")
'Select the record matching the username.
   sql = "SELECT * FROM tblusers WHERE UCase(username)=' "& UCase(username) & "' AND UCase(password)=' " & UCase(password) & " ' "
   set rec=Con.execute(sql)
   'If no match found, EOF is not true.
   if NOT rec.EOF then
      Response.Redirect("somepage.asp") 'Change to page redirect to after login
   else
      blankError="Invalid username." 'EOF is true, no match found.
   end if

To this
If username <> "" and password <> "" then
  Dim Con, sql, rec
   set Con = Server.CreateObject("ADODB.Connection")
  Con.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("database.mdb")
'Select the record matching the username.
   sql = "SELECT * FROM tblusers WHERE UCase(username)=' "& UCase(username) & "' AND UCase(password)=' " & UCase(password) & " ' "
   set rec=Con.execute(sql)
   'If no match found, EOF is not true.
   if NOT rec.EOF then
      Response.Redirect("somepage.asp") 'Change to page redirect to after login
   else
      blankError="Invalid username." 'EOF is true, no match found.
   end if
end if

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
 
Old February 16th, 2007, 04:59 PM
Friend of Wrox
 
Join Date: Feb 2007
Location: Fleet, , United Kingdom.
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to neil.abachi07
Default

Hi,

I will try that now, thanks.

How can i read how the sql statement is accessing the database?

Neil

 
Old February 16th, 2007, 05:08 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Response.Write(sql)

That will show you your sql statement.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html




Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic page creation DyerOppenheimer BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 June 29th, 2009 05:34 PM
delayed login account creation GameGorilla BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 4 January 22nd, 2008 11:27 PM
Creation of HTML page by C# Somesh C# 1 January 24th, 2007 03:21 PM
Newbie Help. Login to unique login page per user Kainan Classic ASP Professional 10 May 3rd, 2005 07:47 AM
username/password creation of login page in asp undercurrent Classic ASP Basics 3 March 21st, 2005 08:38 PM





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