Connecting with a Data Provider
- Last Updated: April 16, 2026
- 1 minute read
- ADO.NET
- Documentation
The DataDirect Connect for ADO.NET data providers attach a data provider-specific prefix to the public .NET objects. For example, the Connection object for the Oracle data provider is OracleConnection.
You can connect to a database through the Connection object, using the method Connection.Open().
C# Example
DbProviderFactory Factory = DbProviderFactories.GetFactory("DDTek.Oracle");
DbConnection Conn = Factory.CreateConnection();
Conn.ConnectionString = "Host=localhost;Port=1521;User ID=scott;Password=tiger;
Service Name=ORCL";
Conn.Open();
Visual Basic Example
Dim df As DbProviderFactoryDf = DbProvideries.GetFactory("DDTek.Oracle");
Dim conn As DbConnection = df.CreateConnection()
conn.ConnectionString = csb.ConnectionString
The following code fragments use the OracleConnection object to connect to Oracle while passing the user name and password.
C# Example
OracleConnection ocon = new OracleConnection("Host=server1;Port=1521
User ID=scott;Password=tiger;Service Name=ORCL");
ocon.Open();
Visual Basic Example
Dim Conn As New OracleConnection Conn = new OracleConnection("Host=server1;
Port=1521;User ID=scott;Password=tiger;Service Name=ORCL")
Conn.Open()