Re: VB And Oracle 7

From: Tyler J. Wilson <twilson_at_vines.colostate.edu>
Date: 22 Mar 1995 16:09:53 GMT
Message-ID: <3kpi4h$3dfv_at_yuma.ACNS.ColoState.EDU>


In article <3kpdm6$rrb_at_ankh.iia.org>, snowden_at_iia.org (Roger Snowden) says:
>
>Declan Higgins (dhiggins_at_bfsec.bt.co.uk) wrote:
>
>: Anyone care to email me a small fragment of Visual Basic
>: code to do the following
>
>Do us all a favor. Post it here. I would like to see it too.
>
>Thanks.

Here is a code snippet that I hope covers what you were looking for.

SUB OpenDatabase()

	Dim ConnectString As String
	Dim db As Database
	Dim ds As Dynaset

        ConnectString = "ODBC;DSN=YourODBCDatabaseName;UID=OracleUsername;
                         PWD=OraclePassword"

        Set db = OpenDatabase("", False, False, ConnectString)
        SQL = "SELECT * FROM YOUR_ORACLE_TABLE WHERE SOME_COLUMN = '"
        SQL = SQL & Control.Value & "'"
        Set ds = db.CreateDynaset(SQL, 64)

	Use dynaset data

	ds.Close
	db.Close

END This code will open the database defined by YourODBCDatabaseName in your ODBC.INI file using the username/password of OracleUsername/OraclePassword. The username and password may be blank if you want the code to prompt for the values. It then will use the SQL Pass Through option on CreateDynaset method.

Hope this helps and clears up any questions. Hope you get your manuals back soon.

PS. You must be using VB Pro 3.0 or Access Basic to use this code. This code was Received on Wed Mar 22 1995 - 17:09:53 CET

Original text of this message