Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Escaping in VBScript

Reply
Thread Tools

Escaping in VBScript

 
 
bobbyballgame
Guest
Posts: n/a
 
      07-03-2003
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


 
Reply With Quote
 
 
 
 
Ray at
Guest
Posts: n/a
 
      07-03-2003
http://www.aspfaq.com/2035

Ray at work

"bobbyballgame" <(E-Mail Removed)> wrote in message
news:ei7fi%(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
 
Bob Barrows
Guest
Posts: n/a
 
      07-03-2003
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



 
Reply With Quote
 
Cowboy \(Gregory A. Beamer\)
Guest
Posts: n/a
 
      07-03-2003
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" <(E-Mail Removed)> wrote in message
news:ei7fi%(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
bobbyballgame
Guest
Posts: n/a
 
      07-03-2003
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" <(E-Mail Removed)> wrote in message
news:u%(E-Mail Removed)...
> 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

>
>



 
Reply With Quote
 
Bob Barrows
Guest
Posts: n/a
 
      07-03-2003
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" <(E-Mail Removed)> wrote in message
> news:u%(E-Mail Removed)...
>> 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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
escaping characters Mike P ASP .Net 1 03-29-2006 03:09 PM
Escaping a CrLf in JavaScript George Durzi ASP .Net 0 07-06-2004 05:03 AM
Re: Escaping a URL in XSL/T Teemu Keiski ASP .Net 0 05-13-2004 04:59 PM
Re: Escaping a URL in XSL/T Swanand Mokashi ASP .Net 0 05-13-2004 04:58 PM
Escaping ' in Javascript ? Ben ASP .Net 4 11-10-2003 06:22 PM



Advertisments