[求助]连接远程数据库的问题
我们老是开了个oracle数据库,要求我们连到那个数据库(给我们提供了计算机IP,数据库名,用户名,密码)我问的问题是:在vb.net中怎么来连接,希望大家说出总体的思路的就可以了?谢谢
This one's from Microsoft, the following are from Oracle
This one works only with Oracle 8i release 3 or later
This one works only with Oracle 8i release 3 or later
C#:
using System.Data.OracleClient;
OracleConnection oOracleConn = new OracleConnection();
oOracleConn.ConnectionString = "my connection string";
oOracleConn.Open();
VB.NET:
Imports System.Data.OracleClient
Dim oOracleConn As OracleConnection = New OracleConnection()
oOracleConn.ConnectionString = "my connection string"
oOracleConn.Open()
上面的方法,我先导入了Imports System.Data.OleDbClient
后来,我又用另外的一种方法,导如了Imports System.Data.OracleClient
代码如下:
Dim constr As String = "Provider=Microsoft OLE DB Provider for Oracle;User
ID=scott;Password=tiger;initial Catalog=mylab;Data Source=202.202.108.35"
Dim mycon As OracleConnection = New OracleConnection(constr)
If mycon.State=ConnectionState Closed Then
mycon.Open()
MsgBox("恭喜你,连接成功了")
End If
运行后:
报错如下:未处理的“System.ArgumentException”类型的异常出现在 system.data.oracleclient.dll 中。
其他信息: Keyword not supported: 'provider'.