Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Oracle 10g Connection using vb.net

Status
Not open for further replies.

dukonia

Programmer
Apr 18, 2007
1
ET
How could I connect Oracle 10g using vb.net(2005)?
Sample source code with namespaces( imports) please.

Thanks in advance.
 
Just call startup


Imports System.Data ' VB.NET
Imports Oracle.DataAccess.Client ' ODP.NET Oracle managed provider
Imports Microsoft.Win32

Public Module modOracleConnect
'Global variables
Public gstrDBConn As String
Public gosessCBankerSession As OracleConnection 'Object
Public gstrDBServer As String
Public Function StartUp() As Boolean

Dim str1 As String


StartUp = True

If Not gosessCBankerSession Is Nothing Then
If gosessCBankerSession.State = ConnectionState.Open Then Exit Function
End If

gstrDBServer = "helpme"
str1 = "User Id=username;" _
& "Password=password"


gstrDBConn = "Data Source=" & gstrDBServer & ";" & str1 & ";"
' & "Statement Cache Size = 20; Statement Cache Purge = true;"

Try
gosessCBankerSession = New OracleConnection(gstrDBConn)

gosessCBankerSession.Open()
gosessCBankerSession.Close()

gosessCBankerSession.Open()

Catch e As OracleException
StartUp = False
Throw e
End Try

End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top