The data adapter stores your command (query) and connection and using these connect to the database when asked, fetch the result of query and store it in the local dataset.
The DataAdapter class (SqlDataAdapter, OracleDataAdapter, OleDbDataAdapter, OdbcDataAdapter) may be instantiated in three ways:
1. by supplying the command string (SQL Select command) and connection string
2. by supplying the command string (SQL Select command) and a connection object
3. by supplying the command object (SqlCommand, OracleCommand, OleDbCommand, OdbcCommand)
For example, with SQL Server, the data adapter is created as
C# Version
// for Sql Server
SqlDataAdapter dataAdapter = new SqlDataAdapter(commandString, conn);
The DataAdapter class (SqlDataAdapter, OracleDataAdapter, OleDbDataAdapter, OdbcDataAdapter) may be instantiated in three ways:
1. by supplying the command string (SQL Select command) and connection string
2. by supplying the command string (SQL Select command) and a connection object
3. by supplying the command object (SqlCommand, OracleCommand, OleDbCommand, OdbcCommand)
For example, with SQL Server, the data adapter is created as
C# Version
// for Sql Server
SqlDataAdapter dataAdapter = new SqlDataAdapter(commandString, conn);