473,320 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

error in query

232 100+
i am php programmer new to asp plz help me to correct the query
crt="WHERE [selcol] like '%colval%"
query = "SELECT [Project List].[Project ID] as pid,
CAST([Project List].[Title of the Project] AS TEXT)as prjtitle,

Student.Title, Student.[Last Name] as iln,
Student.[First Name] as ifn, Student.Designation

FROM [Project List] INNER JOIN
Student ON Student.[Project ID]=[Project List].[Project ID]"+crt+;
Set rs = objConn.Execute(Query)




Error Type:
Microsoft VBScript compilation (0x800A0409)
Unterminated string constant
/web/aspweb/main.asp, line 15, column 51
query = "SELECT [Project List].[Project ID] as pid,
---------------------------------------------------------^
Dec 11 '08 #1
3 1874
if you have your code continuing on another line as it looks like you do in your post, that is the problem.

In VBScript, to be able to continue your code on another line you have to use
the line continuation character at the end of each continued line, except for the last. The line continuation character is "-" and it must have a space before it.

In addition, the entire string you are building is not terminated correctly. at the end you have crt+;. All string literals have to be enclosed. Or possibly you though you should end the line like JavaScript with a semicolon- again wrong.

I have rewritten those lines below.

Expand|Select|Wrap|Line Numbers
  1. query = "SELECT [Project List].[Project ID] as pid, _
  2. CAST([Project List].[Title of the Project] AS TEXT)as prjtitle, _
  3. Student.Title, Student.[Last Name] as iln, _
  4. Student.[First Name] as ifn, Student.Designation _
  5. FROM [Project List] INNER JOIN _
  6. Student ON Student.[Project ID]=[Project List].[Project ID] "+crt
I don't guarantee your page will still work - there still may be problems, but have to start somewhere.
Dec 11 '08 #2
kkshansid
232 100+
$crt="WHERE [$selcol] like '%$colval%"
q="select* from std $crl"
in php double quote will take variable as variable and query executes correctly
i want to know what should i do for that in asp
Dec 12 '08 #3
"$crt" is not a valid variable name in VBScript...
Refer to the link below for rules on naming variables.
Only string literals should be between your double quotes.

For simple debugging of what is held in variables I often use something like this:
Expand|Select|Wrap|Line Numbers
  1. Response.Write(<put your string expression or variables here>)
  2. Response.End
To append string variables and literals together use the "&" operator.

Example:
Expand|Select|Wrap|Line Numbers
  1. Dim strVal : strVal = "Hello World!"
  2. Response.Write("Value =" & strVal & "<br>")
  3. Response.End
Additionally, make sure you use proper spacing in your SQL statements and literals need to be enclosed by single quotes (your statement only had a single quote on one end, from what was put on the web page here).
Expand|Select|Wrap|Line Numbers
  1. crt="WHERE [$selcol] like '%$colval%'"
  2. q="select * from std " & crt
  3.  
Here is a reference for VBScript.
VBScript Language Reference

Here is a link in that reference for Variables.
VBScript Variables

Let me know how that all works for you.
Dec 12 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Polar | last post by:
I am having troubles finding the parse error in this script. I've been checking for weeks. I am too new to the subject I guess. I am trying to show a readord and them have a form at the bottom...
1
by: Steve | last post by:
I just spent waaaaaaaaaaaayy too much time trying to track down an error that was incorrectly reported just now, and I would like to see if someone can explain to me why it was reported that way. ...
0
by: Morten Gulbrandsen | last post by:
C:\mysql\bin>mysql -u elmasri -pnavathe company Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 29 to server version: 4.1.0-alpha-max-debug Type...
3
by: user_5701 | last post by:
Hello, I'm getting an error with a Docmd.Transferspreadsheet line of code: DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel2000, "tblTest", pathAndFilename, True The above line...
3
by: Nathan Bloomfield | last post by:
Hi there, I am having difficulty with a piece of code which would work wonders for my application if only the error trapping worked properly. Basically, it works as follows: - adds records...
2
by: frbn | last post by:
hi all, we currently experience an original problem on a production server with a postgresql 7.1.3 ( a bit old, I know :\ ) We just want to know if somebody experienced this problem: the...
6
by: rn5a | last post by:
During registration, users are supposed to enter the following details: First Name, Last Name, EMail, UserName, Password, Confirm Password, Address, City, State, Country, Zip & Phone Number. I am...
10
by: bobf | last post by:
I am using a program 'My Contact Table' which is a code generator program. It allows you to easily create a PHP/MySQL web application without writing any code. I am trying to create an additional...
0
by: .nLL | last post by:
Erorr is --------------------- Microsoft VBScript runtime error '800a0046' Permission denied /a.asp, line 3 -----------------------
15
by: Lawrence Krubner | last post by:
Does anything about this script look expensive, in terms of resources or execution time? This script dies after processing about 20 or 25 numbers, yet it leaves no errors in the error logs. This is...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.