473,395 Members | 1,986 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,395 software developers and data experts.

Escaping in VBScript

I am having a problem calling Stored Procedures:

....
dim MyValue, MyOtherValue

MyValue = "Bobby's value"
MyOtherValue = Bobby's other value"

rs.Open "exec MyStoredProc """ & MyValue & """, """ & MyOtherValue & """",
Conn
' I have also tried the "'" & MyValue & "'" format as well
....

the problem appears to be related to the single quote, as ones without
quotes seemed to work. Is there escaping and is their URI escaping?

Thanks,BB
Jul 19 '05 #1
5 6324
http://www.aspfaq.com/2035

Ray at work

"bobbyballgame" <so*****@microsoft.com> wrote in message
news:ei****************@tk2msftngp13.phx.gbl...
I am having a problem calling Stored Procedures:

...
dim MyValue, MyOtherValue

MyValue = "Bobby's value"
MyOtherValue = Bobby's other value"

rs.Open "exec MyStoredProc """ & MyValue & """, """ & MyOtherValue & """", Conn
' I have also tried the "'" & MyValue & "'" format as well
...

the problem appears to be related to the single quote, as ones without
quotes seemed to work. Is there escaping and is their URI escaping?

Thanks,BB

Jul 19 '05 #2
You can avoid all these delimiter-and-escaping headaches by using this
method to call your procedure:

Conn.MyStoredProc MyValue,MyOtherValue

HTH,
Bob Barrows
PS. Do not use this technique if you are planning to run this page via
dotnet.

bobbyballgame wrote:
I am having a problem calling Stored Procedures:

...
dim MyValue, MyOtherValue

MyValue = "Bobby's value"
MyOtherValue = Bobby's other value"

rs.Open "exec MyStoredProc """ & MyValue & """, """ & MyOtherValue &
"""", Conn
' I have also tried the "'" & MyValue & "'" format as well
...

the problem appears to be related to the single quote, as ones without
quotes seemed to work. Is there escaping and is their URI escaping?

Thanks,BB

Jul 19 '05 #3
All ' become '' (two single quotes)

MyValue = "Bobby's value"
MyOtherValue = Bobby's other value"

rs.Open "exec MyStoredProc """ & ConvertSingleQuotes(MyValue) & """, """ &
ConvertSingleQuotes(MyOtherValue) & """",
Conn
' I have also tried the "'" & MyValue & "'" format as well
Function ConvertSingleQuotes(InputVal)
ConvertSingleQuotes = Replace(InputVal,"'","''")
End Function
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
Author: ADO.NET and XML: ASP.NET on the Edge

************************************************** **************************
****
Think Outside the Box!
************************************************** **************************
****
"bobbyballgame" <so*****@microsoft.com> wrote in message
news:ei****************@tk2msftngp13.phx.gbl...
I am having a problem calling Stored Procedures:

...
dim MyValue, MyOtherValue

MyValue = "Bobby's value"
MyOtherValue = Bobby's other value"

rs.Open "exec MyStoredProc """ & MyValue & """, """ & MyOtherValue & """", Conn
' I have also tried the "'" & MyValue & "'" format as well
...

the problem appears to be related to the single quote, as ones without
quotes seemed to work. Is there escaping and is their URI escaping?

Thanks,BB

Jul 19 '05 #4
Bob,
Thanks, I would like to avoid delimiter, escaping, encoding, charsets -->
whatever I can. However, using your method it is not clear how you would get
the resultSet. Is there a way?

Thanks,
BB

"Bob Barrows" <re*******@yahoo.com> wrote in message
news:u%****************@TK2MSFTNGP12.phx.gbl...
You can avoid all these delimiter-and-escaping headaches by using this
method to call your procedure:

Conn.MyStoredProc MyValue,MyOtherValue

HTH,
Bob Barrows
PS. Do not use this technique if you are planning to run this page via
dotnet.

bobbyballgame wrote:
I am having a problem calling Stored Procedures:

...
dim MyValue, MyOtherValue

MyValue = "Bobby's value"
MyOtherValue = Bobby's other value"

rs.Open "exec MyStoredProc """ & MyValue & """, """ & MyOtherValue &
"""", Conn
' I have also tried the "'" & MyValue & "'" format as well
...

the problem appears to be related to the single quote, as ones without
quotes seemed to work. Is there escaping and is their URI escaping?

Thanks,BB


Jul 19 '05 #5
I'm sorry. i showed you how to execute a non-records-returning procedure. Te
execute a procedure that returns records, first instantiate a recordset
object:
set rs=server.createobject("adodb.recordset")

then use the recordset variable as the last argument in the procedure call:
Conn.MyStoredProc MyValue,MyOtherValue, rs

HTH,
Bob Barrows

bobbyballgame wrote:
Bob,
Thanks, I would like to avoid delimiter, escaping, encoding, charsets
--> whatever I can. However, using your method it is not clear how
you would get the resultSet. Is there a way?

Thanks,
BB

"Bob Barrows" <re*******@yahoo.com> wrote in message
news:u%****************@TK2MSFTNGP12.phx.gbl...
You can avoid all these delimiter-and-escaping headaches by using
this method to call your procedure:

Conn.MyStoredProc MyValue,MyOtherValue

HTH,
Bob Barrows
PS. Do not use this technique if you are planning to run this page
via dotnet.

bobbyballgame wrote:
I am having a problem calling Stored Procedures:

...
dim MyValue, MyOtherValue

MyValue = "Bobby's value"
MyOtherValue = Bobby's other value"

rs.Open "exec MyStoredProc """ & MyValue & """, """ & MyOtherValue
& """", Conn
' I have also tried the "'" & MyValue & "'" format as well
...

the problem appears to be related to the single quote, as ones
without quotes seemed to work. Is there escaping and is their URI
escaping?

Thanks,BB

Jul 19 '05 #6

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

Similar topics

4
by: Dave Moore | last post by:
Hi All, Can anybody point me to a FAQ or similar that describes what all this stuff is about please?. I'm interfacing with a MySQL database if that's relavent. I've read a couple of books which...
0
by: Hans | last post by:
Hi! Can someone explain how ASP works when it comes to unicode characters on the querystring? See the testcode below. If you type in a chinese character in the first textbox and click "post" the...
14
by: Jon Maz | last post by:
Hi, I have been getting hopelessly confused with escaping escape characters in JScript! All I want to do is write a simple funtion: function DoubleUpBackSlash(inputString) { ??????? }
11
by: Geoff Caplan | last post by:
Hi folks, The thread on injection attacks was very instructive, but seemed to run out of steam at an interesting point. Now you guys have kindly educated me about the real nature of the issues,...
5
by: Mike P | last post by:
I need to put the following code within a <% %> block : response.write "<tr>" &_ "<td bgcolor=eeeeee><a href=""company.asp?company=rs("companyKey")" & "orderby=name"">"&naym&"</a></td>" How...
4
by: Jon | last post by:
Hi, I used XslCompiledTransform with the following Xsl file. The <xsl:text disable-output-escaping="yes"does not work when using XslCompiledTransform to do the trnasform (namely the output...
3
by: Taras_96 | last post by:
Hi everyone, I'm having a bit of trouble understanding the purpose of escaping nulls, and the use of addcslashes. Firstly, the manual states that: "Strictly speaking, MySQL requires only...
1
by: David Henderson | last post by:
I know 'disable-output-escaping' has been discussed in the past, but I can't put my finger on any of the threads to see if my current problem is addressed. Sorry for re-asking the question if it...
46
by: C C++ C++ | last post by:
what is an escaping variable?
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
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
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...

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.