Click here to Skip to main content
15,881,173 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm having problem with this code, this is my first time to use oracle. :)
Help me please. I'm using VS 2008

Imports System.Data.OracleClient
Imports System.Configuration.ConfigurationSettings

Public Class DBConnection

Dim _Conn As System.Data.OracleClient.OracleConnection


Public Function OracleConString() As String
Return "Data Source=" & AppSettings("DataSource") & _
"; User ID=" & AppSettings("DBUserID") & _
"; Password=" & AppSettings("DBPassword")

End Function

Public Function OracleConn() As System.Data.OracleClient.OracleConnection
_Conn = New System.Data.OracleClient.OracleConnection(OracleConString)
Return _Conn
End Function
End Class
Posted
Updated 5-Mar-12 21:40pm
v3
Comments
Tejas Vaishnav 6-Mar-12 3:33am    
what is the problem...
Tejas Vaishnav 6-Mar-12 3:35am    
please be specific while asking a solutions of your problem, means at the time you need to provide some more information like if you got any error then provide that error message as well as in code need to mention where you got that error...

1 solution

i think you need to test this connection string format, might be it will solve your problem..

C#
<add name="CONNECTIONSTRINGNAME" connectionstring="Data Source=(DESCRIPTION=(ADDRESS_LIST=(FAILOVER=yes)(LOAD_BALANCE=yes)(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.3.244)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.3.244)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.3.244)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.3.244)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=YOURORACLESERVICENAMEHERE)));User Id=system;Password=Softweb#123;" providername="System.Data.OracleClient" />
 
Share this answer
 
Comments
Alan Tuscano 6-Mar-12 4:09am    
sorry bout that Tejas,

but i think, the problem was my connection to oracle.. got this solve already.. got this new warning regarding "appsettings"..
the warning is;

'Public Shared ReadOnly Property AppSettings() As System.Collections.Specialized.NameValueCollection' is obsolete: 'This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings'.

below is my connection

Imports System.Data.OracleClient
Imports System.Configuration.ConfigurationSettings

Public Class DBConnection

Dim _Conn As System.Data.OracleClient.OracleConnection

Public Function OracleConString() As String
Return "Data Source=" & AppSettings("DataSource") & _
"; User ID=" & AppSettings("DBUserID") & _
"; Password=" & AppSettings("DBPassword") & ";"


End Function

End Class

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900