ADO.NET | |
ADO.NET is an integral part of .Net Framework, providing access to relational, XML, application data. | |
| |
Create Connection Create connection to data source; here I am using sql connection. SQLConnection con= new SQLConnection(“datasource=localhost;database=Northwind; Integrated Security=true”)Create command SQLCommand cmd = new SQLCommand(“select * from Products”,con);Execute command Use either connected/disconnected architecture, Here I am using connected data model using DataReader. Close connection Finally close the connection. Con.Close(); | |
SqlClient provides classes that are highly optimized to connect sql server using .Net. SqlClient data provider is faster than any other data provider in Ado.Net. It is faster because it connect sql data source directly using native library. | |
They are used to connect a data to a command object.
| |
Command object is used to connect connection object to DataReader or DataSet, to execute query against data source. | |
| |
DataAdapter objects can connect one or more command objects to DataSet. They provide login that gets the data from the datastore and populates the tables in the DataSet,or pushes the changes in the DataSet back into the data store. | |
DataReader Vs DataAdapter.
| |
No, you must explicitly close the connection by calling Close or Dispose. | |
ADO.NET |
Interview Questions on ADO.NET
Interview questions on ADO.NET
Posted by
Ramu