Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How do I use Oracle bind variables using ADO in Visual Basic?
tojo <TomJordanTojo_at_hotmail.com> wrote in message news:<MPG.174376807c7a2b7a98968a_at_news.t-online.de>...
> In article <df35b276.0205080727.6933e5f3_at_posting.google.com>,
> burgess_at_sympatico.ca says...
> > I'd rather not rewrite the database layer to use OO4O, if at all
> > possible. If there a way to use bind variables (ie. SELECT x FROM y
> > WHERE z = :v) in ADO?
>
> Just use ADO's parameters collection and a question mark (?) as a bind
> variable in your SQL. Here's an example from the docs:
>
>
> Dim objCon As NEW ADODB.Connection
> Dim objCmd As NEW ADODB.Command
> Dim prEmpno As NEW ADODB.Parameter
> Dim prEname As NEW ADODB.Parameter
> ...
> objCmd.ActiveConnection = objCon
> objCmd.CommandType = adCmdText
>
> ' Create and append the parameters to the command object
-- snip --
> -- tojo
Thank you, Tom. After my post, I kept searching and found another
good example here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iisref/html/psdk/asp/iiwadata.asp
(Scroll down to the heading "Improving Queries with the Command
Object".)
--Bob Received on Thu May 09 2002 - 08:42:53 CDT