Oracle conection with VB.NET
Visual Basic
2
Posts
2
Posters
0
Views
1
Watching
-
You can use the Microsoft OLEDB provider for Oracle with the
System.Data.OleDb
objects; you can use the Microsoft native provider for Oracle with theOracleClient
objects; or you can use Oracle's own .NET provider (I haven't used it so I'm not sure its object library). For OLEDB, you would use something like this code:Imports System.Data.OleDb
Sub DoSomethingInOracle()
'-- setup a connection string for Oracle
'-- using the Microsoft OleDb provider
Const kConnectionString = _
"Provider=MSDAORA.1;User ID=myUser; Password=myPass;Data Source=myServer;"Dim conn As OleDbConnection Try '--establish the connection conn = New OleDbConnection(kConnectionString) conn.Open() '--do something useful with the connection; '-- probably setup an OleDbCommand object '-- to run a query, or execute a stored '-- procedure... ... Catch ex As Exception '--do something with the exception ... Finally '--close and dispose the OleDbConnection object conn.Dispose() End Try
End Sub