VB.NET连接ORACLE数据库
请问VB.NET如何连接ORACLE数据库?
[解决办法]
下面的示例创建一个 OracleConnection,并在连接字符串中设置它的一些属性。
Visual Basic 复制代码
Public Sub CreateOracleConnection()
Dim connectionString As String = _
"Data Source=Oracle8i;Integrated Security=yes "
Using connection As New OracleConnection(connectionString)
connection.Open()
Console.WriteLine( "ServerVersion: " + connection.ServerVersion _
+ ControlChars.NewLine + "DataSource: " + connection.DataSource)
End Using
End Sub
[解决办法]
链接oracle服务器端,一定要安装oracle客户端。
[解决办法]
OracleConnection.ConnectionString
[解决办法]
Dim str4 As String
Dim connection2 As OleDbConnection
Dim adapter As New OleDbDataAdapter
str4 = "select * from dept "
connection2 = New OleDbConnection "Provider=OraOLEDB.Oracle.1;User ID=scott;Data Source=hong;Password=tiger ")
adapter = New OleDbDataAdapter(str4, connection2)
Dim DataSet21 As DataSet = New DataSet
adapter.Fill(DataSet21, "dept ")