home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 18,727 of 19,505   
   Erland Sommarskog to Bob Barrows   
   Re: Escape Characters in Strings   
   23 Aug 12 23:13:52   
   
   From: esquel@sommarskog.se   
      
   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   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca