VB to .NET

TODO #7010

The connection string must be verified to fulfill the .NET data provider connection string requirements.

Description 

In most cases, the conversion of ADO, RDO or DAO to ADO.NET will require a manual modification of the connection string.

Recommendations 

ADO.NET uses different parameters to connect to the database. The easiest way to know the appropriate connection string in the .NET environment is to use the "Data Connections" tool, which can be found in the "Server Explorer" tab of the .NET IDE, to create a new connection to the database and get the complete connection string from there.

Sample VB6

'---Connection---

'Instantiate the connection
Set cnConexion = New Connection

'Configure the connection string
strConex = "DRIVER=SQL Server;Database=NorthwindSQL;APP=Microsoft Data Access Components;SERVER=.\SQLEXPRESS"

'Set the connection string of the Connection object
cnConexion.ConnectionString = strConex

'Open the connection
cnConexion.Open

Target VB.NET

'---Connection---

 

'Instantiate the connection

 

Dim cnConexion AsNew SqlConnection

 

 

'Configure the connection string

 

Dim strConex AsString = "DRIVER=SQL Server;Database=NorthwindSQL;APP=Microsoft Data Access Components;SERVER=.\SQLEXPRESS"

 

 

'Set the connection string of the Connection object

 

cnConexion.ConnectionString = strConex

 

'Open the connection

 

'UPGRADE_TODO: (7010) The connection string must be verified to fullfill the .NET data provider conecction string requirements.

 

cnConexion.Open()

Expected VB.NET 

'---Connection---

'Instantiate the connection

Dim cnConexion AsNew SqlConnection

'Configure the connection string

Dim strConex AsString = "Data Source=.\SQLEXPRESS;Initial Catalog=NorthwindSQL;Integrated Security=True"

'Set the connection string of the Connection object

cnConexion.ConnectionString = strConex

'Open the connection

'UPGRADE_TODO: (7010) The connection string must be verified to fullfill the .NET data provider conecction string requirements.

cnConexion.Open()

Target C#

//---Connection---

//Instantiate the connection

SqlConnection cnConexion = newSqlConnection();

//Configure the connection string

string strConex = "DRIVER=SQL Server;Database=NorthwindSQL;APP=Microsoft Data Access Components;SERVER=.\\SQLEXPRESS";

//Set the connection string of the Connection object

cnConexion.ConnectionString = strConex;

//Open the connection

//UPGRADE_TODO: (7010) The connection string must be verified to fullfill the .NET data provider conecction string requirements.

cnConexion.Open();

Expected C#

//---Connection---

//Instantiate the connection

SqlConnection cnConexion = newSqlConnection();

//Configure the connection string

string strConex = @"Data Source=.\SQLEXPRESS;Initial Catalog=NorthwindSQL;Integrated Security=True";

//Set the connection string of the Connection object

cnConexion.ConnectionString = strConex;

//Open the connection

//UPGRADE_TODO: (7010) The connection string must be verified to fullfill the .NET data provider conecction string requirements.

cnConexion.Open();

 

Talk To An Engineer