共用方式為


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)

Syntax

'Declaration
Public Sub New ( _
    connectionString As String, _
    tableName As String _
)
public DataSourceAttribute(
    string connectionString,
    string tableName
)
public:
DataSourceAttribute(
    String^ connectionString, 
    String^ tableName
)
new : 
        connectionString:string * 
        tableName:string -> DataSourceAttribute
public function DataSourceAttribute(
    connectionString : String, 
    tableName : String
)

Parameters

  • connectionString
    Type: String

    Data provider-specific connection string.

  • tableName
    Type: String

    The name of the data table.

Remarks

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.

Note

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.

.NET Framework Security

See Also

Reference

DataSourceAttribute Class

DataSourceAttribute Overload

Microsoft.VisualStudio.TestTools.UnitTesting Namespace

Random