473,396 Members | 2,140 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,396 software developers and data experts.

problems with strings and " in asp: how to use the the quotation mark correctly?

Hello,
I have problems with the quotation mark and strings in my asp script.

I made a general FORM (myform.asp) to read out data from a dbase

Some vars are defined in the FORM:
SQL_DBASE
SQL_SELECT
SQL_TABLE
SQL_CONDITION

In the script, this information is glued together as a SQL expression:
SQL = "SELECT " & SQL_SELECT & " FROM " & SQL_TABLE & " WHERE " &
SQL_CONDITION & " ;"
and a table is generated from this SQL statement

However,
I want to call this form also with an external link and pars some
parameters,
example:
<a href="myform.asp?var01=string01">Mylink</a>

When this link is activated, the form myform.asp is called with querystring
var01=string01
and SQL_CONDITION becomes:
SQL_CONDITION = "MyField = '" & Request.QueryString("var01") & "'"
However
The SQL_CONDITION shows NOT up correctly in my form, it becomes
MyField =

in stead of
MyField = "string01"
The problem is that the '-character is not converted to a "-character
anybody?

any help is appreciated

bartp

--
HyperART
Paul Van Ostaijenlaan 4
3001 Heverlee

Jul 19 '05 #1
8 2107
Does this line:
SQL = "SELECT " & SQL_SELECT & " FROM " & SQL_TABLE & " WHERE " &
SQL_CONDITION & " ;"

come before this line?
SQL_CONDITION = "MyField = '" & Request.QueryString("var01") & "'"

And what does this yield?
Response.Write Request.Querystring("var01")

And what do you mean about ' being converted to "?

Ray at work
"Bart Plessers (artabel)" <ba**********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hello,
I have problems with the quotation mark and strings in my asp script.

I made a general FORM (myform.asp) to read out data from a dbase

Some vars are defined in the FORM:
SQL_DBASE
SQL_SELECT
SQL_TABLE
SQL_CONDITION

In the script, this information is glued together as a SQL expression:
SQL = "SELECT " & SQL_SELECT & " FROM " & SQL_TABLE & " WHERE " &
SQL_CONDITION & " ;"
and a table is generated from this SQL statement

However,
I want to call this form also with an external link and pars some
parameters,
example:
<a href="myform.asp?var01=string01">Mylink</a>

When this link is activated, the form myform.asp is called with querystring var01=string01
and SQL_CONDITION becomes:
SQL_CONDITION = "MyField = '" & Request.QueryString("var01") & "'"
However
The SQL_CONDITION shows NOT up correctly in my form, it becomes
MyField =

in stead of
MyField = "string01"
The problem is that the '-character is not converted to a "-character
anybody?

any help is appreciated

bartp

--
HyperART
Paul Van Ostaijenlaan 4
3001 Heverlee

Jul 19 '05 #2
Use the single Quote in all HTML Values and in the SQL Statement and
you will have a lot less trouble.

Also HTML Values don't need any quotes at all if they are single words
without and spaces, although I still always use single quotes anyway.
--

Phillip Windell [CCNA, MVP, MCP]
pw******@wandtv.com
WAND-TV (ABC Affiliate)
www.wandtv.com

"Bart Plessers (artabel)" <ba**********@hotmail.com> wrote in message
news:#D**************@TK2MSFTNGP10.phx.gbl...
Hello,
I have problems with the quotation mark and strings in my asp script.
I made a general FORM (myform.asp) to read out data from a dbase

Some vars are defined in the FORM:
SQL_DBASE
SQL_SELECT
SQL_TABLE
SQL_CONDITION

In the script, this information is glued together as a SQL expression: SQL = "SELECT " & SQL_SELECT & " FROM " & SQL_TABLE & " WHERE " &
SQL_CONDITION & " ;"
and a table is generated from this SQL statement

However,
I want to call this form also with an external link and pars some
parameters,
example:
<a href="myform.asp?var01=string01">Mylink</a>

When this link is activated, the form myform.asp is called with querystring var01=string01
and SQL_CONDITION becomes:
SQL_CONDITION = "MyField = '" & Request.QueryString("var01") & "'"
However
The SQL_CONDITION shows NOT up correctly in my form, it becomes
MyField =

in stead of
MyField = "string01"
The problem is that the '-character is not converted to a "-character

anybody?

any help is appreciated

bartp

--
HyperART
Paul Van Ostaijenlaan 4
3001 Heverlee

Jul 19 '05 #3
Gazing into my crystal ball I observed "Phillip Windell" <pwindell{at}
wandtv*d0t*com> writing in news:uE**************@TK2MSFTNGP10.phx.gbl:
Also HTML Values don't need any quotes at all if they are single words
without and spaces, although I still always use single quotes anyway.


HTML attributes need quotes if they are character values. XHTML requires
ALL attributes be quoted.

--
Adrienne Boswell
Please respond to the group so others can share
http://www.arbpen.com
Jul 19 '05 #4
found the solution:

SQL_CONDITION = "Gallery = " & chr(34) & Request.QueryString("Gallery") &
chr(34)

with the chr(34) the problems were all solved.

When I used ', I had some problems running the query

Anyway, thanx for your time!

bartp

--

==========================================
Hyper A.R.T.
bart plessers
Paul Van Ostaijenlaan 4
3001 Heverlee
BELGIUM
tel: +32 (16) 23.40.85
fax: +32 (16) 23.41.06
==========================================

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:#j*************@TK2MSFTNGP12.phx.gbl...
Does this line:
SQL = "SELECT " & SQL_SELECT & " FROM " & SQL_TABLE & " WHERE " &
SQL_CONDITION & " ;"

come before this line?
SQL_CONDITION = "MyField = '" & Request.QueryString("var01") & "'"

And what does this yield?
Response.Write Request.Querystring("var01")

And what do you mean about ' being converted to "?

Ray at work
"Bart Plessers (artabel)" <ba**********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hello,
I have problems with the quotation mark and strings in my asp script.

I made a general FORM (myform.asp) to read out data from a dbase

Some vars are defined in the FORM:
SQL_DBASE
SQL_SELECT
SQL_TABLE
SQL_CONDITION

In the script, this information is glued together as a SQL expression:
SQL = "SELECT " & SQL_SELECT & " FROM " & SQL_TABLE & " WHERE " &
SQL_CONDITION & " ;"
and a table is generated from this SQL statement

However,
I want to call this form also with an external link and pars some
parameters,
example:
<a href="myform.asp?var01=string01">Mylink</a>

When this link is activated, the form myform.asp is called with

querystring
var01=string01
and SQL_CONDITION becomes:
SQL_CONDITION = "MyField = '" & Request.QueryString("var01") & "'"
However
The SQL_CONDITION shows NOT up correctly in my form, it becomes
MyField =

in stead of
MyField = "string01"
The problem is that the '-character is not converted to a "-character
anybody?

any help is appreciated

bartp

--
HyperART
Paul Van Ostaijenlaan 4
3001 Heverlee


Jul 19 '05 #5
I had to go verify it without "official webmaster", our resident
in-house HTML expert....she says that although most people still use
the quotes, words do not require quotes if they consist of only one
word with no spaces:

value = phil <-- is fine
value = phil windell <-- will not work
value = 'phil windell' or value = "phil windell" <-- is fine
Although most people still include quotes as either a standard
practice or just habit.
--

Phillip Windell [CCNA, MVP, MCP]
pw******@wandtv.com
WAND-TV (ABC Affiliate)
www.wandtv.com

"Adrienne" <ar****@sbcglobal.net> wrote in message
news:Xn***************************@207.115.63.158. ..
HTML attributes need quotes if they are character values. XHTML requires ALL attributes be quoted.

--
Adrienne Boswell
Please respond to the group so others can share
http://www.arbpen.com

Jul 19 '05 #6
"Phillip Windell" <pwindell{at}wandtv*d0t*com> wrote in message
news:O$**************@TK2MSFTNGP12.phx.gbl...
I had to go verify it without "official webmaster", our resident


Stinking "typos"! should say, "...verify it with *our*...."
Jul 19 '05 #7
Gazing into my crystal ball I observed "Phillip Windell" <pwindell{at}
wandtv*d0t*com> writing in news:uU*************@TK2MSFTNGP10.phx.gbl:
"Phillip Windell" <pwindell{at}wandtv*d0t*com> wrote in message
news:O$**************@TK2MSFTNGP12.phx.gbl...
I had to go verify it without "official webmaster", our resident


Stinking "typos"! should say, "...verify it with *our*...."


Well, hopefully your "official webmaster" is aware that XHTML does require
all attributes to be quoted.

See http://www.w3.org/TR/xhtml1/diffs.html#h-4.4

--
Adrienne Boswell
Please respond to the group so others can share
http://www.arbpen.com
Jul 19 '05 #8
I don't know, I assume she does...we don't use any XHTML or XML.
--

Phillip Windell [CCNA, MVP, MCP]
pw******@wandtv.com
WAND-TV (ABC Affiliate)
www.wandtv.com

"Adrienne" <ar****@sbcglobal.net> wrote in message
news:Xn****************************@207.115.63.158 ...
Well, hopefully your "official webmaster" is aware that XHTML does require all attributes to be quoted.

See http://www.w3.org/TR/xhtml1/diffs.html#h-4.4

Jul 19 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Martin Goldman | last post by:
Hello all, I've been struggling for a few days with the question of how to convert "smart" (curly) quotes into straight quotes. I tried playing with the htmlentities() function, but all that is...
4
by: Thomas Miskiewicz | last post by:
Hi! Is using of a double quotation mark with a URL a problem? For example: http://myserver.com/query?field1=something&field2=test&params="field1=test1"+"field2=test2" Regards Thomas
2
by: sparks | last post by:
ok I was trying to do something real simple I thought Me.Clinic.DefaultValue = Me.Clinic.Value I got error either ! or . misused or not found...something like that I thought ok how can you not...
4
by: nsj | last post by:
How shall i use quotation marks within another in asp.net?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
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,...

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.