-
ASp error message in browser!!
In "preview in browser", I get the following error message when testing my login validation and session object code using Dreamweaver Ultradev for ASP 2.0 Vbscript What's wrong?
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.
/cute14remote/portal/TMP1s9zcjqdcl.asp, line 20
This is the actual code: (line 20 is labeled)
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../Connections/conncute14.asp" -->
<%
Dim rsPartners__login
rsPartners__login = "nvlue"
if (Request.Form("login") <> "") then rsPartners__login = Request.Form("login")
%>
<%
Dim rsPartners__password
rsPartners__password = "nadanan"
if (Request.Form("password") <> "") then rsPartners__password = Request.Form("password")
%>
<%
set rsPartners = Server.CreateObject("ADODB.Recordset")
rsPartners.ActiveConnection = MM_conncute14_STRING
rsPartners.Source = "SELECT " + Replace(rsPartners__login, "'", "''") + ", " + Replace(rsPartners__password, "'", "''") + " FROM newapplicants WHERE " + Replace(rsPartners__login, "'", "''") + " = '" + Replace(rsPartners__login, "'", "''") + "' AND " + Replace(rsPartners__password, "'", "''") + " = '" + Replace(rsPartners__password, "'", "''") + "'"
rsPartners.CursorType = 0
rsPartners.CursorLocation = 2
rsPartners.LockType = 3
rsPartners.Open() ---------------------Line 20 HERE!--------------------------------------------
rsPartners_numRows = 0
%>
<%
if Not rsPartners.EOF or Not rsPartners.BOF AND Request.Form("login") = "true" AND rslogin.RecordCount = 1 Then
Session("UserID")=rslogin.Fields.Item("login").Val ue
Response.redirect "controlpanel.asp"
ElseIf Request.Form("login") = "true" then
Response.redirect "loginfail.htm"
End If
%>
-
my first impression(translation: first guess)
Hey,
If you get an error in the open statement, most often, it is something wrong with your sql statement.
First of all, that sql statement is fairly messy looking. For better readability, I would read all of the passed variables(login and pass) into new variables and at that time do the replaces.
rsPartners.Source = "SELECT " + Replace(rsPartners__login, "'", "''") + ", " + Replace(rsPartners__password, "'", "''") + " FROM newapplicants WHERE " + Replace(rsPartners__login, "'", "''") + " = '" + Replace(rsPartners__login, "'", "''") + "' AND " + Replace(rsPartners__password, "'", "''") + " = '" + Replace(rsPartners__password, "'", "''") + "'
So, now your problem, it looks like in the FROM part, you didn't put the field name, but accidentaly put the actual variable...
so it's doing this.
FROM newapplicants WHERE loginname = loginname AND password = password
where it should be
FROM newapplicants WHERE field_name_of_login = loginname AND field_name_of_password = password
hope this helps, since I don't know dreamweaver, but know some asp.
dragonB
p.s. and of course if this is wrong, qball will be along shortly to help us out.
-
I think I have a solution, it goes a lot like the one mrfrogs suggested, but hear me out. I have a little experience in UD, so here goes.
In your SQL select statement, you have a SQL statement that looks like this:
Code:
SELECT login, password
FROM newapplicants
WHERE login = login AND password = password
When UD parses this, it sees your "login" and "password" variables twice, and replaces them.
A better way of trying this to not get this sort of confusion is to use a WHERE clause like this:
Code:
WHERE login = varlogin AND password = varpassword
Making sure that you change your recordset variables accordingly.
Hope this helps!
-
Senior Member
I've had that error before. I simply changed the name of the conflicting column in my database and it fixed it. The variable wasn't even in use by the same script. It was residing in memory from a previously ran script.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
New Security Features Planned for Firefox 4
Another Laptop Theft Exposes 21K Patients' Data
Oracle Hits to Road to Pitch Data Center Plans
Microsoft Preps Array of Windows Patches
Microsoft Nears IE9 Beta With Final Preview
Simplified Analytics Improve CRM, BI Tools
Android Passes RIM as Top Mobile OS in 2Q
VMware Updates Hyperic System Management
File Monitoring Key to Enterprise Security
LinkedIn Snaps Up SaaS Player mSpoke
|
Bookmarks