Create Oracle connection string using APP.CONFIG file
<_connectionstrings>
< name="CONN_NAME" connectionstring="Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.250.10.10)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SID=SIDNAME)));User Id=username;Password=password">
< /connectionStrings >
Second step.
open the connection string
Imports Microsoft.VisualBasic
Imports System.Configuration
Imports System.Data
Imports System.Data.OracleClient
Imports System.Exception
Dim conn As OracleConnection
Try
conn = New OracleConnection(ConfigurationManager.ConnectionStrings("CONN_NAME").ConnectionString)
Catch ex As Exception
Throw ex
Finally
conn.Dispose()
End Try
No comments:
Post a Comment