Query Syntax In My Sql
I just decided to leave Mssql and start using Mysql. I am having some problems with my queries; is there anyone here who has a knowledge of query syntax in Mysql?
View RepliesI just decided to leave Mssql and start using Mysql. I am having some problems with my queries; is there anyone here who has a knowledge of query syntax in Mysql?
View RepliesIs it possible to use IIF function in SQL query?like that for example:
objCommand.CommandText = "Select WCUST, IIF(Sum(WQTY2002) Is Not Null, ((Sum(WQTY2003)-Sum(WQTY2002)) * 100/Sum(WQTY2002)),Null) AS ChangeUnits, IFF(Sum(WAMT2002) Is Not Null, ((Sum(WAMT2003)-Sum(WAMT2002)) * 100/Sum(WAMT2002)), Null) from tabTest group by WCUST;"
I'm having a problem With Query5, inserting the 'HF' variable into the DB, PF and HF both print out correct values when asked to do so. I think its a problem with my SQL query syntax but i'm at a loss as to what could be wrong.
The Error the Browser sends is - "Expected end of statement" Code:
Would like to redirect the results of a form and pass the information in two fields ("x_amount") and ("x_description) on the form to that page.
Response.Redirect "../cgi-bin/test.asp?Request("x_amount")&Request("x_description") - this is not working.
Where I found this?
Like this:
SELECT
SELECT TOP N
INTO
FROM
WHERE
GROUP BY
HAVING
UNION (ALL)
ORDER BY
WITH OWNERACCESS
( http://msdn.microsoft.com/library/e.../access2sql.asp )
But with explanations (usage) and samples...
to search based on the beginning characters the sql should be
sql="SELECT * FROM Employee Where Emp_Id Like '" & strId & "%'"
I'm working on a page so that a user can change their password. I thought might be a simple update of a database, but everytime I do it I get the following error message. I've put x's where my ID would be showing for security purposes. Code:
View Replies View Related1) 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 execute the following SQL Statement:
SqlApp1 = "INSERT INTO LeagueStore (Team, Played, Wins, Loses, Draws, For, Against, Points) SELECT (Team, Played, Wins, Loses, Draws, For, Against, Points) from HomeWins WHERE postponed=''"
But i am getting the following error message:
Syntax error (comma) in query expression '(Team, Played, Wins, Loses, Draws, For, Against, Points)'.
And i dont know why. All of the fields are numerical apart from TEAM is that helps.
All i want to do is Insert data from one table into another but i cant use SELECT * because one table has one extra field to the other and when i tried to amend the SQL to look like this:
SqlApp1 = "INSERT INTO LeagueStore (Team, Played, Wins, Loses, Draws, For, Against, Points) SELECT * from HomeWins WHERE postponed=''"
i get this error:
Number of query values and destination fields are not the same
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().
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?
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:
Can I use this syntax
Where NOT IN (".....)
in a situation I don't want to select items in the list.
If not what other ways can do that.
I'm just trying to display a user's FIRST name and the FIRST INITIAL of the last name on my asp web page.
This works to displays their "firstName" and "lastName":
Code:
<%=oUsers("firstName")%> <%=oUsers("lastName")%>
But I get a variety of vbscript or asp syntax errors when I try to trim the "lastName" using something like
Code:
<%=oUsers("firstName")%> <%=oUsers(replace(left("lastName",1))%>
How do get this simple task done?
(If it makes any difference, the whole thing is inside html <td></td> tags as part of a table)
I can't see to find where the syntax is wrong because I can do the query just fine in access but my asp page gets this error
Microsoft JET Database Engine error '80040e14'
Syntax error in INSERT INTO statement.
Here is what the insert looks like when I print it out in the page
INSERT INTO tblusers (username,password,[Timestamp],email) VALUES('testuser', 'c4ca4238a0b923820dcc509a6f75849b', '10/16/2004', 'me@home.com')
Here is the code:
I am trying to query a database for 2 conditions but I can't get the query to work.
Can anybody see a problem with this line of code?Code:
strQuery="SELECT Count(*) AS intTotal FROM tbl_artists WHERE fld_artist_name = '" & strReqname & "'" "AND fld_user_id ='"& strUsername & "'",objConn,,,adCMDText
objRS.Open strQuery,objConn,,,adCMDText
numRecords = objRS("intTotal")
I have a textarea and have named it category_One.
I have sent the data in this form on using the POST method
contents_category_One = Request.Form("category_One")
I have then used the following sql statement
sql = "INSERT INTO tableName(Category_One) VALUES ('"& contents_category_One &"');"
If someone inserts ' in the text box, this value is causing a syntax error in the sql statement.
The WHERE part of my select needs to pull out where the date column is empty. If there isn't a date, it shows NULL in the database (SQL7)."WHERE eligibility_dt <> NULL" doesn't work. what am i forgetting?
View Replies View RelatedI need help with ASP. when i post data to the database, do the records in my form need to be in the same amount as the database records?
View Replies View RelatedWould anyone have some syntax for a query (SQL2000) that would return results for records that are over 24 hours old (date field is smallDateTime)?
View Replies View RelatedI believed that there is a wrong syntax on the window.open line...Can anyone spot it ?
Code:
strLocation = "Sch_As_FollowAct.asp?drvid=" & request("drv") & "&u=" & uday(0)
response.write "<script>" & vbCrLf
response.write "window.open('" & strLocation & "' & ",menubar=1,resizable=1,width=350,height=250");" & vbCrLf
response.write "</script>"
i am having some trouble rembering the correct syntax for a If Then Statement here is my code.
<% If Request.QueryString("access") = "false" Then %>
<tr>
<td colspan="2" bgcolor="#FFFFFF" class="mediumRed">The User
ID and Password combination has failed.<br> <br>
Please try again.</td>
</tr>
<% Else If rsGettblCouples.Fields.Item("StopDate") = "1/1/1900" Then %>
<tr>
<td colspan="2" bgcolor="FFFFFF" class="mediumRed"> The User has already<br>
completed the online scoring.<br>Please Contact your facilitator.</td>
</tr>
<% End If %>
<% End If %>
Can someone direct me a set of rules for building strings in ASP? I'm always getting stuck on when to use a quote (") or apostrophe{'} or both. This simple string is giving me fits...
Response.Redirect("test3.asp?orderno='" &
(rsProducts.Fields.Item("OrderNo").Value) & "')"
I can't seem to get the right combination.