The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DataSourceAttribute Constructor (String, String)


Initializes a new instance of the DataSourceAttribute class. This instance will be initialized with a connection string and table name.

Namespace:   Microsoft.VisualStudio.TestTools.UnitTesting
Assembly:  Microsoft.VisualStudio.QualityTools.UnitTestFramework (in Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll)

public DataSourceAttribute(
	string connectionString,
	string tableName


Type: System.String

Data provider-specific connection string.

Type: System.String

The name of the data table.

It is important to note that properties are set at initialization for this object. This constructor overload uses the default value of System.Data.OleDb for the data provider name and uses the default value of Random for the data access method.


The connection string can contain sensitive data (for example, a password). The connection string is stored in plain text in source code and in the compiled assembly. Restrict access to the source code and assembly to protect this sensitive information.

Return to top