473,396 Members | 2,002 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.

Quotes/Blanks in ASP

I have part of the following SQL statement:

'*********
SELECT
d_service_area.service_area AS ServiceArea,
d_environment.environment AS Environment,
d_platform_function.platform_function AS Platform,
d_hw_type.hw_type AS hdwType,
d_hardware.standard AS hdwHardware,
d_hardware.config_vrsn AS hdwVersion,
d_sw_type.sw_type AS sfwType,
d_software.standard AS sfwSoftware,
d_software.config_vrsn AS sfwVersion,
hw_sw.time_frame AS tf,
hw_sw.impl_plan_start_date AS pStDate,
hw_sw.impl_act_start_date AS aStDate,
hw_sw.impl_plan_duration AS pDur,
0 AS cmtTyp,
0 AS cmtSeq,
" " AS cmt
'******************
I need to embed this into my ASP page so that I can make
calls to my DB, but the last line, " " AS cmt , is
throwing me for a loop. How do I handle this?

I know the following isn't correct:
******************
"SELECT " & _
"d_service_area.service_area AS ServiceArea, " & _
"d_environment.environment AS Environment, " & _
"d_platform_function.platform_function AS
Platform, " & _
"d_hw_type.hw_type AS hdwType, " & _
"d_hardware.standard AS hdwHardware, " & _
"d_hardware.config_vrsn AS hdwVersion, " & _
"d_sw_type.sw_type AS sfwType, " & _
"d_software.standard AS sfwSoftware, " & _
"d_software.config_vrsn AS sfwVersion, " & _
"hw_sw.time_frame AS tf, " & _
"hw_sw.impl_plan_start_date AS pStDate, " & _
"hw_sw.impl_act_start_date AS aStDate, " & _
"hw_sw.impl_plan_duration AS pDur, " & _
"0 AS cmtTyp, " & _
"0 AS cmtSeq, " & _
"" "AS cmt " & _

*******************

Thanks in advance for any help!
Jul 19 '05 #1
5 1129
Use ' instead of " in SQL. Also, you have an erroneous "& _" at the end of
your statement.

When you do need to include " in a string, you double it. Like, "He said,
""Hi. How are you?"""

Ray at work

"Shawn" <an*******@discussions.microsoft.com> wrote in message
news:0c****************************@phx.gbl...
I have part of the following SQL statement:

'*********
SELECT
d_service_area.service_area AS ServiceArea,
d_environment.environment AS Environment,
d_platform_function.platform_function AS Platform,
d_hw_type.hw_type AS hdwType,
d_hardware.standard AS hdwHardware,
d_hardware.config_vrsn AS hdwVersion,
d_sw_type.sw_type AS sfwType,
d_software.standard AS sfwSoftware,
d_software.config_vrsn AS sfwVersion,
hw_sw.time_frame AS tf,
hw_sw.impl_plan_start_date AS pStDate,
hw_sw.impl_act_start_date AS aStDate,
hw_sw.impl_plan_duration AS pDur,
0 AS cmtTyp,
0 AS cmtSeq,
" " AS cmt
'******************
I need to embed this into my ASP page so that I can make
calls to my DB, but the last line, " " AS cmt , is
throwing me for a loop. How do I handle this?

I know the following isn't correct:
******************
"SELECT " & _
"d_service_area.service_area AS ServiceArea, " & _
"d_environment.environment AS Environment, " & _
"d_platform_function.platform_function AS
Platform, " & _
"d_hw_type.hw_type AS hdwType, " & _
"d_hardware.standard AS hdwHardware, " & _
"d_hardware.config_vrsn AS hdwVersion, " & _
"d_sw_type.sw_type AS sfwType, " & _
"d_software.standard AS sfwSoftware, " & _
"d_software.config_vrsn AS sfwVersion, " & _
"hw_sw.time_frame AS tf, " & _
"hw_sw.impl_plan_start_date AS pStDate, " & _
"hw_sw.impl_act_start_date AS aStDate, " & _
"hw_sw.impl_plan_duration AS pDur, " & _
"0 AS cmtTyp, " & _
"0 AS cmtSeq, " & _
"" "AS cmt " & _

*******************

Thanks in advance for any help!

Jul 19 '05 #2

"Shawn" <an*******@discussions.microsoft.com> wrote in message
news:0c****************************@phx.gbl...
I know the following isn't correct:
******************
"SELECT " & _
"d_service_area.service_area AS ServiceArea, " & _
"d_environment.environment AS Environment, " & _
"d_platform_function.platform_function AS
Platform, " & _
"d_hw_type.hw_type AS hdwType, " & _
"d_hardware.standard AS hdwHardware, " & _
"d_hardware.config_vrsn AS hdwVersion, " & _
"d_sw_type.sw_type AS sfwType, " & _
"d_software.standard AS sfwSoftware, " & _
"d_software.config_vrsn AS sfwVersion, " & _
"hw_sw.time_frame AS tf, " & _
"hw_sw.impl_plan_start_date AS pStDate, " & _
"hw_sw.impl_act_start_date AS aStDate, " & _
"hw_sw.impl_plan_duration AS pDur, " & _
"0 AS cmtTyp, " & _
"0 AS cmtSeq, " & _
"" "AS cmt " & _


Try :

"0 AS cmtSeq, " & _
""" ""AS cmt " & _

Though you may find if you're running anything > then SQL 6.5 that you
should rather use single qoutes... so :

"0 AS cmtSeq, " & _
"' 'AS cmt " & _
Jul 19 '05 #3
Shawn wrote:
I have part of the following SQL statement:

'*********
SELECT
" " AS cmt
'******************
I need to embed this into my ASP page so that I can make
calls to my DB, but the last line, " " AS cmt , is
throwing me for a loop. How do I handle this?

Two options:
1. Use single-quotes (') instead of double quotes. Most databases recognize
this"
strSQL = "Select ..., ' ' As cmt ... "

2. If your database does not recognize single quotes as delimiters, escape
your double-quotes by doubling them:
strSQL = "Select ..., "" "" As cmt ... "

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.
Jul 19 '05 #4
swp
use single quotes instead of double quotes.

"Shawn" <an*******@discussions.microsoft.com> wrote in message news:<0c****************************@phx.gbl>...
I have part of the following SQL statement:

'*********
SELECT
d_service_area.service_area AS ServiceArea,
d_environment.environment AS Environment,
d_platform_function.platform_function AS Platform,
d_hw_type.hw_type AS hdwType,
d_hardware.standard AS hdwHardware,
d_hardware.config_vrsn AS hdwVersion,
d_sw_type.sw_type AS sfwType,
d_software.standard AS sfwSoftware,
d_software.config_vrsn AS sfwVersion,
hw_sw.time_frame AS tf,
hw_sw.impl_plan_start_date AS pStDate,
hw_sw.impl_act_start_date AS aStDate,
hw_sw.impl_plan_duration AS pDur,
0 AS cmtTyp,
0 AS cmtSeq,
" " AS cmt
'******************
I need to embed this into my ASP page so that I can make
calls to my DB, but the last line, " " AS cmt , is
throwing me for a loop. How do I handle this?

I know the following isn't correct:
******************
"SELECT " & _
"d_service_area.service_area AS ServiceArea, " & _
"d_environment.environment AS Environment, " & _
"d_platform_function.platform_function AS
Platform, " & _
"d_hw_type.hw_type AS hdwType, " & _
"d_hardware.standard AS hdwHardware, " & _
"d_hardware.config_vrsn AS hdwVersion, " & _
"d_sw_type.sw_type AS sfwType, " & _
"d_software.standard AS sfwSoftware, " & _
"d_software.config_vrsn AS sfwVersion, " & _
"hw_sw.time_frame AS tf, " & _
"hw_sw.impl_plan_start_date AS pStDate, " & _
"hw_sw.impl_act_start_date AS aStDate, " & _
"hw_sw.impl_plan_duration AS pDur, " & _
"0 AS cmtTyp, " & _
"0 AS cmtSeq, " & _
"" "AS cmt " & _

*******************

Thanks in advance for any help!

Jul 19 '05 #5
swp
a little more complete answer (total time to type, including these
notes: 15 minutes)

no optimization on the SQL - use INNER JOINs and whatever relations
you have set up already instead of the clunky FROM clause below. I
did use table alias names to cut it down a bit and make it more
readable.

no optimization on building the SQL string - you may want to do other
things with the FROM, WHERE, GROUP BY and ORDER BY clauses.

=====================================
DIM xsql, xrs, xcon
DIM db_name, username, password

db_name = "SystemDSN_you_set_up_in_Data_Sources(ODBC)"
username = "someone_allowed_into_this_database"
password = "some_strong_password_you_set_for_him"

xsql = "SELECT "
xsql = xsql & "sa.service_area AS ServiceArea, "
xsql = xsql & "e.environment AS Environment, "
xsql = xsql & "pf.platform_function AS Platform, "
xsql = xsql & "hwt.hw_type AS hdwType, "
xsql = xsql & "h.standard AS hdwHardware, "
xsql = xsql & "h.config_vrsn AS hdwVersion, "
xsql = xsql & "swt.sw_type AS sfwType, "
xsql = xsql & "s.standard AS sfwSoftware, "
xsql = xsql & "s.config_vrsn AS sfwVersion, "
xsql = xsql & "hstime_frame AS tf, "
xsql = xsql & "hs.impl_plan_start_date AS pStDate, "
xsql = xsql & "hs.impl_act_start_date AS aStDate, "
xsql = xsql & "hs.impl_plan_duration AS pDur, "
xsql = xsql & "0 AS cmtTyp, "
xsql = xsql & "0 AS cmtSeq, "
xsql = xsql & "' ' AS cmt "
xsql = xsql & "FROM "
xsql = xsql & "d_service_area sa, "
xsql = xsql & "d_environment e, "
xsql = xsql & "d_platform_function pf, "
xsql = xsql & "d_hw_type hwt, "
xsql = xsql & "d_hardware h, "
xsql = xsql & "d_sw_type swt, "
xsql = xsql & "d_software s, "
xsql = xsql & "hw_sw hs "
xsql = xsql & "WHERE blah blah blah "
xsql = xsql & "ORDER BY bitty boppity boo "

set xcon = server.CreateObject("ADODB.Connection")
xcon.Open db_name, username, password
set xrs = xcon.execute(xsql)
if (not xrs.eof and not xrs.bof) then ' we got records back
' do stuff with your recordset called xrs
else
' error message or whatever you do with no data returned
end if
set xrs = nothing
xcon.close
set xcon = nothing

=====================================

swp

DS******@aol.com (swp) wrote in message news:<a5**************************@posting.google. com>...
use single quotes instead of double quotes.

"Shawn" <an*******@discussions.microsoft.com> wrote in message news:<0c****************************@phx.gbl>...
I have part of the following SQL statement:

'*********
SELECT
d_service_area.service_area AS ServiceArea,
d_environment.environment AS Environment,
d_platform_function.platform_function AS Platform,
d_hw_type.hw_type AS hdwType,
d_hardware.standard AS hdwHardware,
d_hardware.config_vrsn AS hdwVersion,
d_sw_type.sw_type AS sfwType,
d_software.standard AS sfwSoftware,
d_software.config_vrsn AS sfwVersion,
hw_sw.time_frame AS tf,
hw_sw.impl_plan_start_date AS pStDate,
hw_sw.impl_act_start_date AS aStDate,
hw_sw.impl_plan_duration AS pDur,
0 AS cmtTyp,
0 AS cmtSeq,
" " AS cmt
'******************
I need to embed this into my ASP page so that I can make
calls to my DB, but the last line, " " AS cmt , is
throwing me for a loop. How do I handle this?

I know the following isn't correct:
******************
"SELECT " & _
"d_service_area.service_area AS ServiceArea, " & _
"d_environment.environment AS Environment, " & _
"d_platform_function.platform_function AS
Platform, " & _
"d_hw_type.hw_type AS hdwType, " & _
"d_hardware.standard AS hdwHardware, " & _
"d_hardware.config_vrsn AS hdwVersion, " & _
"d_sw_type.sw_type AS sfwType, " & _
"d_software.standard AS sfwSoftware, " & _
"d_software.config_vrsn AS sfwVersion, " & _
"hw_sw.time_frame AS tf, " & _
"hw_sw.impl_plan_start_date AS pStDate, " & _
"hw_sw.impl_act_start_date AS aStDate, " & _
"hw_sw.impl_plan_duration AS pDur, " & _
"0 AS cmtTyp, " & _
"0 AS cmtSeq, " & _
"" "AS cmt " & _

*******************

Thanks in advance for any help!

Jul 19 '05 #6

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

Similar topics

1
by: Andreas Lauffer | last post by:
I use Blanks in ColumnNames ( I know that this isn´t very good, but a lot of code and querys had to be changed if I would remove all blanks in all columnnames). When I link this tables with ODBC...
6
by: jalkadir | last post by:
I am trying to find a way to remove the leading and tailing blanks from a string. What I have come up with is not doing the work as I expected; because if the value I pass to the function is "...
2
by: William Kossack | last post by:
I have an Access table with one primary key and am attempting to update a non-key field, using UPDATE tblMethtest SET fev1timemeth = '' WHERE SID = '0041R'; When I do this, the field...
2
by: John Hoge | last post by:
I have a regex "^\d{5}$" that does not allow blanks, but the RegularExpressionValidator does not fire for empty fields. Is there a way to make it do so? I would rather not include a separate...
5
by: dean | last post by:
sSQL = " update SELECTED_NODES " " set LABEL_S = 'Y' " " where NODE_I in " " ( " " select NODE_I " " from " " ( " " select ONODE_I NODE_I from link " " union all "
34
by: Registered User | last post by:
Hi experts, I'm trying to write a program that replaces two or more consecutive blanks in a string by a single blank. Here's what I did: #include <stdio.h> #include <string.h> #define MAX 80
10
by: Diego F. | last post by:
Hi all. I have an application that receives a message from a socket in an array from a certain size. As the array size may be longer that the message received, the end of the array has blank...
4
by: eBob.com | last post by:
I have a RichTextBox in which I'd like blanks to appear different from nothing. Imagine a file which does not fill up the RTB. You can't tell how many, if any, blanks might follow the last...
8
by: DL | last post by:
The following line is dynamically generated, which works fine at least with IE7 but what I want more out of it is to disable this button upon click, so, pls see next line of my attempt to use CSS...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
Oralloy
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,...
0
tracyyun
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...
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.