Query With AND/OR Operator
I have 6 textboxes where if I fill them up I want the query to search if either one of them has results found. I have this but it's not working: Code:
View RepliesI have 6 textboxes where if I fill them up I want the query to search if either one of them has results found. I have this but it's not working: Code:
View Repliesi have a drop down list that populates a table based on the user input. The table than has some products, I'm trying to have the product name link to another page with full details about the product. I'm close but just need some help with the sql. The sql is:
"Select * FROM tablename WHERE ID =" & request.Form("ID")
ID is defined as autonum in the database, the error message i'm getting is:
Syntax error (missing operator) in query expression 'ID ='.
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? Code:
I'm getting this error:
Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error (missing operator) in query expression ''I'm not really sure what all that stuff means. Do you have the divider pages with the tabs to stick in and organize things? If so i'll take 10 of those too. Thanks.''.
/employee_forms/testing/databaseclerical.asp, line 60
when running this code: .....
I'm getting this error:
Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error (missing operator) in query expression ''I'm not really sure what all that stuff means. Do you have the divider pages with the tabs to stick in and organize things? If so i'll take 10 of those too. Thanks.''.
/employee_forms/testing/databaseclerical.asp, line 60
when running this code: ....
Any ideas why im getting this error from these lines of code?
" WHERE [Personnel].p_id = [specialists].[p_id] " & _
" AND*[specialists].spu_id = " & Cint(Request.form("spec"))
valuA = (request.form("toadd"))
If valuA = "" then
SQL = "UPDATE CourseReg SET attended='Active' WHERE ID
IN("&request.form("toadd")&")"
Set RS = MyConn.Execute(SQL)
End If
MyConn.Close
Set RS = Nothing
Set MyConn = Nothing
the error
syntax error (missing operator) query expression ID IN ()
First time poster here but I've spent a while lurking and reading the great threads here
I've got a problem that I've wrapped my head around for a few days and I can't seem to figure it out.
Im using ASP with Access 2000 DB. I want to perform a simple lookup by ID (AutoNumber in Access) and it says I am missing an operator. Code:
I am trying to insert values into a database using an sql statement that i read from a table that contains all my different sql commands. The sql statement is stored in the following way in the table: Code:
View Replies View RelatedI am recieving the Microsoft JET Database Engine (0x80040E14) Syntax error (missing operator) in query expression when updating data that contains single quote marks, for example: Code:
View Replies View RelatedI'm trying to pass a piece of data i get from a query using a different form's passed values. This is how I get the data into the new form and how I try to pass it to the next asp page query.
<td valign=TOP width="168"><form action="HouseDetail.asp" method="post" name="MLS" id="MLS"><input name="MLS" type="hidden" value='<%=oRs("ML_Number")%>'><input name="Submit2" type="submit" value="Get Details"/></form></td>
The value='<%=oRS(ML_Number")%>' generates a real value like '2403943' - and the field I'm trying to use this value in the qry is expecting a number. But even passing the number without the single ' at both ends generates the same error message. Code:
I am working on a project using an access db. Here is the problem.
Error
Code:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing
operator) in query expression 'unit=6400s'
Unit is what it is suppose to be, I don't understand why I am getting this error? Here's the code for this part.
Code:
sql="SELECT * FROM " & tableStr & " WHERE Model=" & unitStr
tableStr and unitStr are variables. Table and unit are passed into the page and are assigned to the two variables through a request.querystring().
I have one string (strWeekday) which contains a single day of the week like 'monday' and another string (strDeldays) which can contain one day of the week or multiple days of the week seperated by commas like 'monday, tuesday, wednesday, thursday, etc'.
I want to execute some lines if strWeekday is equal or may contain one of the days in strDeldays. I do not know what operator and what syntax to use for this.
Does anyone know how to convert this peice of
php code to asp?
Quote:
$xxpop= $variable1|$variable2|$variable3|$variable4
I am having problems understanding the ASP equvilent of the " | " bitwise operator.
Basicly I pull the whole column contents and what to test to see if the username is that list. How can I do this in an if statement. I know how to do this kind of thing in SQL (LIKE operator) but I need to test agains two recordsets. Code:
View Replies View Relatediam trying to insert some data into a database but i keep getting the above error msg this is the line that is causing the problems any ideas?
Code:
sql3 = "Insert INTO course_dates ([Course_Id], [Course_Heading], [Course_Title], [Week_No], Status) VALUES ("&courseid&", "&course&", "&title&", "&weekno&", "&status&")"
here is what is printed when I response.write the sql3 statement
Insert INTO course_dates ([Course_Id], [Course_Heading], [Course_Title], [Week_No], Status) VALUES (285, NEBOSH, test, Week One, TBA)
I'm having probs with this sql, I know it's something to do with the LIKE operator. I'm tring to see if there are any instances of a single letter from one field in a comma seperated list in another field. Code:
View Replies View Relatedmy SQL keeps coming back with the following error
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Clients.Area_ID = 3 AND Clients.Category_ID = 7 OR WHERE Clients.Category_ID = 7 AND Clients.All_Areas = true'.
I am trying to pull out all records where area and category match, aswell as all records where category match and all_areas = true
Any suggestions as to where I am going wrong?
Code:
This is the sql statement:
sqlquery="SELECT * FROM tblrequest WHERE Req_id= " & Req_id & " "
set rs=con.execute (sqlquery)
Req_id is coming from a form like so:
Req_id=request.form("Req_id")
The error is:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Req_id='.
On the first line of the query.
See anything wrong that would cause this error?
Please help, the Req_id is being sent from previous form via a hidden value hope i'm requesting this properly.
My code retrieves a username and a password from a form. Then this information is compared to some usernames and passwords that are stored in a database. The important thing here is that the comparison must be case sensitive meaning that "passWord" is not the same thing as "password"
I have this code, working fine in access 2003
SQL = "SELECT * FROM users WHERE StrComp(username_column,'" & entered_username_in_form & "',0) = 0 AND StrComp(password_column,'" & entered_password_in_form & "',0) = 0"
but get the following error when I run it against my sql 2005 database.
[Microsoft][SQL Native Client][SQL Server]'StrComp' is not a recognized built-in function name.
I don't know the corresponding t-sql for the query.
I am running a querry on an access database and have set the number of records/page displayed at 20. if there are more than 20 records returned, then 1st page will show the first 20, the next page will show next 20 and so on....
The trouble:
the count of total records displayed is correct and the first page is displayed correctly. But when i click on *Next* to go to the next page, all the records of the database get displayed (not the 2nd page of records from the query).
I am using ASP/MS ACCESS to see how I can query the same database, via 2 formfields.
{name: - search}Textfield 1: - Search by Category
AND/OR By
{name: - searchT}Textfield 2: - Location
Currently,
strSearchwords = Trim(Request.QueryString("search")); where "search" is the name of Textfield1
Which is fine, but how can I set it so that on Submit, the string from search, and searchT are somehow joined together into one string?
I cant seem to get the LIKE oprator to work in asp.
I am trying to verify e-mail input format by using
request("email") like "*@*.*"
but it returns "sub or function not defined"
any suggestions?
In Access you use "*" + [passed variable] + "*", + can be replaced with &
Calling a parameterized query in Access requires % be used in place of *,
however, all that I have read show dynamic SQL passed to Access:
WHERE [some column] LIKE '" & ASPvar & "' % ORDER BY ...
However, my call is similar to:
conn.qMyLookup strVar, rs
If I modify the query in Access to:
"%" & [passed variable] & "%"
I get all records. If I only put it at the end, as suggested, I only get
matches at the end, not throughout the column. Code:
Is it possible to write sql query to fetch records from
specific record number?
lets say i have one variable and it stores values such as
1,2,3 or so...
if variable contains, i want to fetch records from 1 to
20.
if it contains 2, then records should be from 21 to 40.
for 3, records would be 41 to 60...
what could be the sql for that?
i dont wannna fetch whole table and then filtering
through code..
i have a table called checkrenewal
it has a field called date_renewal
data is stored like this
03/20/2007
05/17/2008
10/21/2006
09/18/2006
09/04/2006
so what i want to do is display only records that are in month of sept for 2006
so there will be 2 records
so next month is Oct 2006 so only display one record
so depending on which month and which year it is display only those records.
I can't write the sum of a certain colum in a table of a db.
<%
sql_Sum_Tax="SELECT SUM(vtax) AS sql_Sum_Tax_RS_Var FROM orderstats
WHERE vcompletedate BETWEEN "& startDate &" AND "& endDate & ";"
Set sql_Sum_Tax_RS = Server.CreateObject("ADODB.Recordset")
sql_Sum_Tax_RS.Open sql_Sum_Tax, conn1
%>
<%=sql_Orders_Placed_RS("sql_Orders_Placed_RS_Var")%>
That last line generates this error:
ADODB.Recordset error '800a0cc1'
Item cannot be found in the collection corresponding to the requested name or ordinal.
i have a table and the fields are
gender
weight
points
the records for example are
Male 55 2.0
Male 60 3.12
Male 65 3.87
Male 70 3.99
so i need to find out the points when the user selects gender and enters the weight
people are allowed to enter weights between 55 and 70
say for example someone enters weight as 55 his points will be 2.0
if someone enters weight as 64 i want the points to be 3.12
I have an Access database of literature that I want to search using an ASP page using multiple search criteria (author, title, year, discipline,etc).
I'm using a form to collect the criteria from the user and then sending it to an ASP page. I'm creating the SQL statement using variables that pick up values passed from the form.
Code:
strSQL = "SELECT * FROM Literature WHERE " & _
"(Author Like '%" & mauthor & "%') AND " & _
"(Title Like '%" & mtitle & "%') AND " & _
"(Journal Like '%" & mjournal & "%') AND "& _
"(ArticleBook Like '%" & mBookOption & "%') AND " & _
"(Year Like '%" & myear & "%') " & _
"ORDER BY Title ASC;"
This would probably work if I used "OR" in my SQL, but I want to be able to use "AND." My problem is that I'm not getting records that have null values in some of these fields.
Ive been working with queries through asp on a mdb file. The biggest problem i have is
that when i query a certian column that had embedded hyperlinks in it, the query also
returns the value of the hyperlink. Is there any way not to have to remove the hyperlinks
in the database and not have them show up on queries? Code:
I am learning ASP from the Wrox Begining E-Commerce book, which uses Visual Basic to create a DLL and it also uses MTS as well.
I have been trying to find hosting not realising the problem with registering custom dll's on server and know realise that this isn't the best way to do this.
I wanted to know if there was anything i could do to change this. I have read a little bit about the Global.isa file but am not sure about this.
Could i just transfer all the code into the global.isa and then use it like this.
My website access a sql database and uses a mts pipeline for order processing.
I don't have enough experience of ASP to re-write this code and am not sure of what to do.
I have tried searching the web but am not really finding any solutions that I understand.
I have one table with date field in sql server2000.I want to write one sql query statement that fetch last three months data from the current month..
View Replies View RelatedI am trying to have the SQL query select from a table where two conditions exist.
The line:
Code:
SQL = "SELECT * FROM CompsIn WHERE Out = -1 "
Works, but I want to have it also select from compsin where UserGroup = Session("UserGroup")
Until I connect the login and the CompsOut pages,adding Where UserGroup='CSU836'
will work just fine.