Using bind variables with Oracle and VB

Posted on 2006-06-08
Last Modified: 2012-08-13
Could someone please provide examples of how to submit select, update, and insert SQL to an Oracle database using bind variables?   (All my Google inquiries keep leading me to VB.NET code.)  

Since this is an select/update that takes place every five minutes against a huge table, bind variables are essential.  And I have a feeling the ADO method I used wasn't the best.

It would also be great if the examples included some error checking.

Thanks in advance for your kind response.
Question by:codefinger
    1 Comment
    LVL 6

    Accepted Solution

    Using ADO you can create a Command Object. Basically it's a temporary store query on the clietn side, that allows parameters. Please try the following code:

    Private cmMyQry as ADODB.Command

        Set cmMyQry = New ADODB.Command
        Set cmMyQry.ActiveConnection = cnMyDB

        With cmMyQry
            .CommandText = "SELECT * FROM TABLE WHERE Field = ?"
            .Parameters.Append .CreateParameter(...)
        End With


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
    I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now