asp.net.ph

SqlDataAdapter Constructor

System.Data.SqlClient Namespace   SqlDataAdapter Class


Initializes a new instance of the SqlDataAdapter class.

Overload List

1. Initializes a new instance of the SqlDataAdapter class.

2. Initializes a new instance of the SqlDataAdapter class with the specified SqlCommand object.

3. Initializes a new instance of the SqlDataAdapter class with the specified Transact-SQL SELECT statement and a connection string.

4. Initializes a new instance of the SqlDataAdapter class with the specified Transact-SQL SELECT statement and an SqlConnection object.


Example

The following example initializes an SqlDataAdapter, then fills a DataSet.

NOTE: This example uses one of the overloaded versions of the SqlDataAdapter constructor. For other examples that may be available, see the individual overload topics.

// set up the connection
string connString = "server=localhost; trusted_connection=yes; database=pubs";
// set up the query
string query = "SELECT * FROM authors";

// set up the adapter
SqlDataAdapter myAdapter = new SqlDataAdapter ( query, connString );

// instantiate dataset object
DataSet myData = new DataSet ( );
// fill with query results
myAdapter.Fill ( myData, "authors" );
  C# VB

See Also

SqlDataAdapter Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph