SqlDataAdapter Constructor (String^, String^)

 

Initializes a new instance of the SqlDataAdapter class with a SelectCommand and a connection string.

Namespace:   System.Data.SqlClient
Assembly:  System.Data (in System.Data.dll)

public:
SqlDataAdapter(
	String^ selectCommandText,
	String^ selectConnectionString
)

Parameters

selectCommandText
Type: System::String^

A String that is a Transact-SQL SELECT statement or stored procedure to be used by the SelectCommand property of the SqlDataAdapter.

selectConnectionString
Type: System::String^

The connection string. If your connection string does not use Integrated Security = true, you can use SqlDataAdapter and SqlCredential to pass the user ID and password more securely than by specifying the user ID and password as text in the connection string.

This overload of the SqlDataAdapter constructor uses the selectCommandText parameter to set the SelectCommand property. The SqlDataAdapter will create and maintain the connection created with the selectConnectionString parameter.

When an instance of SqlDataAdapter is created, the following read/write properties are set to the following initial values.

Properties

Initial value

MissingMappingAction

MissingMappingAction.Passthrough

MissingSchemaAction

MissingSchemaAction.Add

You can change the value of any of these properties through a separate call to the property.

The following example creates a SqlDataAdapter and sets some of its properties.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: