Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-sqlserver > #1233

Re: Escape Characters in Strings

From Erland Sommarskog <esquel@sommarskog.se>
Newsgroups comp.databases.ms-sqlserver
Subject Re: Escape Characters in Strings
Date 2012-08-23 23:13 +0200
Organization Erland Sommarskog
Message-ID <XnsA0B8EC523442AYazorman@127.0.0.1> (permalink)
References (1 earlier) <XnsA0B7614C3AD91Yazorman@127.0.0.1> <2s0a38toaa3n1th1e42kmat8n0ei6v9bah@4ax.com> <XnsA0B7D82775B60Yazorman@127.0.0.1> <n5ha38dbi03o3npmc3emukmisrb2qevl53@4ax.com> <k152pv$scc$1@dont-email.me>

Show all headers | View raw


Bob Barrows (reb01501@NOSPAMyahoo.com) writes:
> Very bizarre. Why not use ADO's innate ability to pass parameter values?
> I see from you're next message that you are using vbscript. So, assuming
> the procedure above returns no records, and that your opened connection
> variable is called "cn", the vbscript to execute the above procedure
> would be: 
> 
> cn.ExampleProc "abc",1,2,3
> 
> Explanation: ADO (2.5 and higher) allows stored procedures to be treated
> as if they are methods of the connection object, allowing the parameter
> values to passed as if you were plassing arguments to a builtin method.
> No need to worry about escaping delimiters, etc. 

Egads! I didn't know of that one. Unfortunately, I don't have an VB 
environment here at home, so I cannot try it.

But how does it work under the covers? I would guess that it runs .Refresh 
under the covers, but I found in the MDAC Books Online that it says:
"ADO will make a 'best guess' of parameter types.".

Neither of these two strategies are really appealing. .Refresh would be 
appealing if it cached the parameter profile, so that the metadata query 
was executed only once, but ADO does not seem to do that. And "best guess"
are like to cause problems when the guesses go wrong.

-- 
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx

Back to comp.databases.ms-sqlserver | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Escape Characters in Strings Gene Wirchenko <genew@ocis.net> - 2012-08-21 15:39 -0700
  Re: Escape Characters in Strings Erland Sommarskog <esquel@sommarskog.se> - 2012-08-22 07:33 +0000
    Re: Escape Characters in Strings Gene Wirchenko <genew@ocis.net> - 2012-08-22 09:10 -0700
      Re: Escape Characters in Strings Erland Sommarskog <esquel@sommarskog.se> - 2012-08-22 21:14 +0200
        Re: Escape Characters in Strings Gene Wirchenko <genew@ocis.net> - 2012-08-22 13:53 -0700
          Re: Escape Characters in Strings Erland Sommarskog <esquel@sommarskog.se> - 2012-08-22 23:35 +0200
            Re: Escape Characters in Strings Gene Wirchenko <genew@ocis.net> - 2012-08-22 17:38 -0700
              Re: Escape Characters in Strings Erland Sommarskog <esquel@sommarskog.se> - 2012-08-23 10:22 +0000
          Re: Escape Characters in Strings "Bob Barrows" <reb01501@NOSPAMyahoo.com> - 2012-08-23 07:05 -0400
            Re: Escape Characters in Strings Erland Sommarskog <esquel@sommarskog.se> - 2012-08-23 23:13 +0200
              Re: Escape Characters in Strings "Bob Barrows" <reb01501@NOSPAMyahoo.com> - 2012-08-23 18:22 -0400
                Re: Escape Characters in Strings Erland Sommarskog <esquel@sommarskog.se> - 2012-08-24 07:40 +0000
                Re: Escape Characters in Strings "Bob Barrows" <reb01501@NOSPAMyahoo.com> - 2012-08-24 06:16 -0400

csiph-web