473,569 Members | 2,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6335
http://www.aspfaq.com/2035

Ray at work

"bobbyballg ame" <so*****@micros oft.com> wrote in message
news:ei******** ********@tk2msf tngp13.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.MyStoredPr oc MyValue,MyOther Value

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 """ & ConvertSingleQu otes(MyValue) & """, """ &
ConvertSingleQu otes(MyOtherVal ue) & """",
Conn
' I have also tried the "'" & MyValue & "'" format as well
Function ConvertSingleQu otes(InputVal)
ConvertSingleQu otes = Replace(InputVa l,"'","''")
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!
*************** *************** *************** *************** *************** *
****
"bobbyballg ame" <so*****@micros oft.com> wrote in message
news:ei******** ********@tk2msf tngp13.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*******@yaho o.com> wrote in message
news:u%******** ********@TK2MSF TNGP12.phx.gbl. ..
You can avoid all these delimiter-and-escaping headaches by using this
method to call your procedure:

Conn.MyStoredPr oc MyValue,MyOther Value

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.creat eobject("adodb. recordset")

then use the recordset variable as the last argument in the procedure call:
Conn.MyStoredPr oc MyValue,MyOther Value, 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*******@yaho o.com> wrote in message
news:u%******** ********@TK2MSF TNGP12.phx.gbl. ..
You can avoid all these delimiter-and-escaping headaches by using
this method to call your procedure:

Conn.MyStoredPr oc MyValue,MyOther Value

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
4415
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 refer to stripslahes and 'escaping' but nothing really explains what these terms are and why these are used. Why is 'escaping' (whatever that is)...
0
2026
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 javascript code will change the action for the <form> and add the text entered in the first editbox to the querystring and then submit the form....
14
3524
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
2163
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, can I ask again what effective escaping really means? Are the standard escaping functions found in the PHP, Tcl etc APIs to Postgres bombproof?...
5
4821
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 do I escape the characters " etc?
4
9159
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 contain < not <), while it works when using MSXML2 to do the transform. Does anyone have the same problem and how to make the escape work? Thanks. ...
3
5367
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 that backslash and the quote character used to quote the string in the query be escaped. This function quotes the other characters to make them easier...
1
5456
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 has already been answered... I have an XML doc that I am transforming via XSLT and JavaScript in the browser. This allows me to return...
46
6228
by: C C++ C++ | last post by:
what is an escaping variable?
0
7612
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7673
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6284
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.