Hello! I've written 2 pages: one i HTML format, and second - in ASP. When
I'm posting data from HTML page, I receive this error generated by ASP page:
Microsoft JET Database Engine (0x80040E14)
Syntax error (missing operator) in query expression '' AND ([ID
Platnika]='OFFICE DEPOT')''.
"Office Depot" is the value from form.
When all values are set to "*" the script generates correct results, but if
its value contains any string it generates the error message shown above.
And this is the code of ASP page:
<%
Dim pT1
Dim pT2
Dim pD1
Dim pD2
Dim pD3
Dim pD4
Dim pK1
Dim pD5
Dim pTP1
Dim pTP2
pT1 = request("T1")
pT2 = request("T2")
pD1 = request("D1")
pD2 = request("D2")
pD3 = request("D3")
pD4 = request("D4")
pK1 = request("K1")
pD5 = request("D5")
pTP1 = request("TP1")
pTP2 = request("TP2")
Dim mySQL 'SQL command to execute
Dim objPagingConn 'The ADODB connection object
Dim objPagingRS 'The ADODB recordset object
Set objPagingConn = Server.CreateOb ject("ADODB.Con nection")
objPagingConn.O pen "Provider=Micro soft.Jet.OLEDB. 4.0; Data Source=" &
Server.MapPath( "../db2.mdb") & ";"
Set objPagingRS = Server.CreateOb ject("ADODB.Rec ordset")
mySQL = ""
If pT1 <> "" And pT2 <> "" Then
mySQL = mySQL & " AND (Data BETWEEN '" & Request ("T1") & "' AND '" &
Request ("T2") & "')"
End If
If pD1 <> "*" Then
mySQL = mySQL & " AND ([Numer faktury]='" & Request ("D1") & "')"
End If
If pD2 <> "*" Then
mySQL = mySQL & " AND ([ID Platnika]='" & Request ("D2") & "')"
End If
If pD3 <> "*" Then
mySQL = mySQL & " AND ([Kategoria]='" & Request ("D3") & "')"
End If
If pD4 <> "*" Then
mySQL = mySQL & " AND ([ID faktury]='" & Request ("D4") & "')"
End If
'If pK1 <> "*" Then
'mySQL = mySQL & " AND ([Kwota]='" & Request ("K1") & "')"
'End If
If pD5 <> "*" Then
mySQL = mySQL & " AND ([Status]='" & Request ("D5") & "')"
End If
If pTP1 <> "" And pTP2 <> "" Then
mySQL = mySQL & " AND ([Termin platnosci] BETWEEN '" & Request ("TP1") & "'
AND '" & Request ("TP2") & "')"
End If
If mySQL <> "" Then
mySQL = "WHERE '" & mySQL & "'"
End If
'---------------------------------------------------------------------------
--------------------------------------------------------
mySQL = "SELECT Data, [Numer faktury], [ID Platnika], Kategoria, [ID
faktury], [Kwota], Status, [Termin platnosci] FROM [Faktury tabela
zbierajaca faktury przychodzace]" & mySQL
'mySQL = mySQL & ";"
objPagingRS.Ope n mySQL, objPagingConn, 1,1 ', adOpenStatic, adLockReadOnly,
adCmdText %>
<% Do While Not objPagingRS.EOF %>
<% response.write objPagingRS("Nu mer faktury") %>"><% response.write
objPagingRS("Nu mer faktury") %><BR>
<% objPagingRS.Mov eNext
Loop
objPagingRS.Clo se
Set objPagingRS = Nothing
objPagingConn.C lose
Set objPagingConn = Nothing
%>
Can anybody tell me what is wrong with this code?
What kind of parentes should I use to prevent this error? I'm using '" &
variable & "' ..... Maybe there is another statement?
Please, help!!!
Maciej, 1 11114
See below for the best technique to debug this:
Maciej Paras wrote: Hello! I've written 2 pages: one i HTML format, and second - in ASP. When I'm posting data from HTML page, I receive this error generated by ASP page:
Microsoft JET Database Engine (0x80040E14) Syntax error (missing operator) in query expression '' AND ([ID Platnika]='OFFICE DEPOT')''.
<snip>
mySQL = "SELECT Data, [Numer faktury], [ID Platnika], Kategoria, [ID faktury], [Kwota], Status, [Termin platnosci] FROM [Faktury tabela zbierajaca faktury przychodzace]" & mySQL 'mySQL = mySQL & ";"
Right here:
Response.Write mySQL
You have no hope of debugging this without knowing exactly what sql
statement you are sending to the database. So, take a look at the result of
the response.write in the browser window. The problem should stand out, but,
if it doesn't, copy and paste the statement from the browser window the the
SQL View of a Query Builder window in Access. Try to run it. At the very
least, you will probably get a better error message.
If you still can't figure it out, show us the sql statement.
HTH,
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: shank |
last post by:
1) I'm getting this error: Syntax error (missing operator) in query
expression on the below statement. Can I get some advice.
2) I searched ASPFAQ and came up blank. Where can find the "rules" for when
and how to use single quotes and double quotes in ASP?
thanks!
----------------------
SQL = SQL & "WHERE '" &...
|
by: dcarson |
last post by:
I've read about this error in several other discussions, but still
can't seem to pinpoint the problem with my code. Everything seemed to
be working fine for some time, but it now tends to bomb out on me for
some reason. The Summary field is pulled from a Rich Text Editor that
allows HTML formatting and appears to be the culprit, but I just...
|
by: Lumpierbritches |
last post by:
Syntax Error (missing operator) in query expression =BLANK'S
MOLLIE-PRINCE BRUISER-3/14/2004-03
AnimalID is correct. I'm trying to open with a command button or double click
the frmAnimal from a subform that uses the same table, is that my problem?
If I remove the criteria from the expression, it opens the form, but to show
every record.
|
by: khan |
last post by:
getting, error, 3075
Syntax Error (Missing Operator) in query expression '8WHERE
.=1'
Dim TotalQty As Integer
TotalQty = DLookup("", "", "=" &
Forms!!)
|
by: deko |
last post by:
I'm trying to log error messages and sometimes (no telling when or where)
the message contains a string with double quotes. Is there a way get the
query to insert the string with the double quotes? Do I need to use code to
scrub each string and remove or escape the double quotes before using it in
a query?
The error I get is this:
...
| |
by: T. Wintershoven |
last post by:
Hi
Can someone please tell me whats wrong with the last line of the query
below. The first three lines work fine but when i add the fourth line i get
an error message (see text at ERROR MESSAGE)
sql_HTTermijnRecords = "select * from Orders where FaktuurGeprint =
'J'" & _
"AND dathergestuurd Is Not Null " & _
"AND PerBankKas Is Null " &...
|
by: John Øllgård Jensen |
last post by:
Hi
Using MS Asccess 2000:
In a query I'm trying to create a new field with following expression:
FilmDate: Left(,4)
The field "FilmNo" is another text field in the query.
This is expression should return the 4 leftmost characters of the FilmNo
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |