Forum Moderators: open

Message Too Old, No Replies

Asp

To have NEED of help

         

BarsK

9:11 am on May 24, 2006 (gmt 0)

10+ Year Member



Thath is Error Type:

Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error (comma) in query expression

Thath is .asp code

<%
Dim rsUsers
Dim rsUsers_numRows

Set rsUsers = Server.CreateObject("ADODB.Recordset")
rsUsers.ActiveConnection = MM_conn_str_STRING
rsUsers.Source = "SELECT * FROM tblUsers WHERE usr_login='" + Replace(rsUsers__param1, "'", "''") + "' , usr_pass='" + Replace(rsUsers__param2, "'", "''") + "' AND usr_activated='" + Replace(rsUsers__param3, "'", "''") + "' "
rsUsers.CursorType = 0
rsUsers.CursorLocation = 2
rsUsers.LockType = 1
rsUsers.Open()
rsUsers_numRows = 0
%>

mattur

9:27 am on May 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



WHERE usr_login='" + Replace(rsUsers__param1, "'", "''") + "' , usr_pass='"...

It looks like you've used a comma before user_pass where you should have used "AND" (as you have for the third where clause):

WHERE usr_login='" + Replace(rsUsers__param1, "'", "''") + "' AND usr_pass='"...

The simple and easy way to debug SQL statements is to temporarily change your code to just response.write the SQL, so you can see the complete SQL statement, copy and paste into Access etc.

BarsK

9:32 am on May 24, 2006 (gmt 0)

10+ Year Member



I change
That is error write

Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.

BarsK

9:36 am on May 24, 2006 (gmt 0)

10+ Year Member



That is full asp code

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1251"%>
<!--#include file="../Connections/conn_str1.asp" -->
<%
Dim rsUsers__param1
rsUsers__param1 = """"
If (Request.Form("UserName") <> "") Then
rsUsers__param1 = Request.Form("UserName")
End If
%>
<%
Dim rsUsers__param2
rsUsers__param2 = """"
If (Request.Form("Password") <> "") Then
rsUsers__param2 = Request.Form("Password")
End If
%>
<%
Dim rsUsers__param3
rsUsers__param3 = """"
If (Request.Form("activated") <> "") Then
rsUsers__param3 = Request.Form("activated")
End If
%>
<%
Dim rsUsers
Dim rsUsers_numRows

Set rsUsers = Server.CreateObject("ADODB.Recordset")
rsUsers.ActiveConnection = MM_conn_str_STRING
rsUsers.Source = "SELECT * FROM tblUsers WHERE usr_login='" + Replace(rsUsers__param1, "'", "''") + "' AND usr_pass='" + Replace(rsUsers__param2, "'", "''") + "' AND usr_activated='" + Replace(rsUsers__param3, "'", "''") + "'"
rsUsers.CursorType = 0
rsUsers.CursorLocation = 2
rsUsers.LockType = 1
rsUsers.Open()
rsUsers_numRows = 0
%>

<%If rsUsers.EOF And rsUsers.BOF Then %>
<% Response.Redirect("Login1.asp?err=Login failed! Please, try again!")%>

<%else%>

<%
Session("usrID")=(rsUsers.Fields.Item("usr_ID").Value)
Response.Redirect("bars1.asp")
%>
<% End If ' end rsUsers.EOF And rsUsers.BOF %>

<%
rsUsers.Close()
Set rsUsers = Nothing
%>