System.Data.SqlClient Namespace SqlDataAdapter Class
Initializes a new instance of the SqlDataAdapter class with the specified Transact-SQL SELECT statement and an SqlConnection object.
[ VB ]
Overloads Public Sub New ( _
ByVal selectCommandText As String, _
ByVal selectConnection As SqlConnection _
)
[ C# ]
public SqlDataAdapter (
string selectCommandText,
SqlConnection selectConnection
);
[ C++ ]
public: SqlDataAdapter (
String* selectCommandText,
SqlConnection* selectConnection
);
[ JScript ]
public function SqlDataAdapter (
selectCommandText : String,
selectConnection : SqlConnection
);
- selectCommandText
- String specifying a Transact-SQL SELECT statement or stored procedure.
- selectConnection
- An SqlConnection that represents the connection.
When an instance of SqlDataAdapter is created, the following read/write properties are set to initial values.
You can change the value of any of these properties through a separate call to the property.
The following example initializes an SqlDataAdapter using this constructor, then fills a DataSet.
// set up the connection
SqlConnection myConn = new SqlConnection (
"server=localhost; trusted_connection=yes; database=pubs" );
// set up the adapter
SqlDataAdapter myAdapter = new SqlDataAdapter ( "SELECT * FROM authors", myConn );
// instantiate dataset object
DataSet myData = new DataSet ( );
// fill with query results
myAdapter.Fill ( myData, "authors" );
' set up the connection
dim myConn as new SqlConnection ( _
"server=localhost; trusted_connection=yes; database=pubs" )
' set up the adapter
dim myAdapter as new SqlDataAdapter ( "SELECT * FROM authors", myConn )
' instantiate dataset object
dim myData as new DataSet ( )
' fill with query results
myAdapter.Fill ( myData, "authors" ) |
|
C# |
VB |
SqlDataAdapter Members SqlDataAdapter Constructor Overload List MissingMappingAction MissingSchemaAction