Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Erland Sommarskog Newsgroups: comp.databases.ms-sqlserver Subject: Re: Escape Characters in Strings Date: Thu, 23 Aug 2012 23:13:52 +0200 Organization: Erland Sommarskog Lines: 33 Message-ID: References: <2s0a38toaa3n1th1e42kmat8n0ei6v9bah@4ax.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Injection-Info: mx04.eternal-september.org; posting-host="9c1143bfab35549403b85d70ea1a57d8"; logging-data="26743"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19/U5j3/tce/MXTTw2eOx4P" User-Agent: Xnews/2006.08.24 Mime-proxy/2.1.c.0 (Win32) Cancel-Lock: sha1:uqGgC02J3q8ODvromyybNwTtaao= Xref: csiph.com comp.databases.ms-sqlserver:1233 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