26.02.2015 Views

DOT NET Interview Questions - DotNetSpider

DOT NET Interview Questions - DotNetSpider

DOT NET Interview Questions - DotNetSpider

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

√<br />

A SqlConnection object uses Tabular Data Services (TDS) with MS SQL Server<br />

(B)What is the use of command objects and what are the<br />

methods provided by the command object ?<br />

They are used to connect connection object to Datareader or dataset.Following are the<br />

methods provided by command object :-<br />

√<br />

√<br />

√<br />

ExecuteNonQuery :- Executes the command defined in the CommandText<br />

property against the connection defined in the Connection property for a query<br />

that does not return any rows (an UPDATE, DELETE or INSERT).Returns<br />

an Integer indicating the number of rows affected by the query.<br />

ExecuteReader :- Executes the command defined in the CommandText property<br />

against the connection defined in the Connection property. Returns a "reader"<br />

object that is connected to the resulting rowset within the database, allowing<br />

the rows to be retrieved.<br />

ExecuteScalar :- Executes the command defined in the CommandText property<br />

against the connection defined in the Connection property. Returns only a<br />

single value (effectively the first column of the first row of the resulting rowset).<br />

Any other returned columns and rows are discarded. Fast and efficient when<br />

only a "singleton" value is required<br />

(B)What is the use of dataadapter ?<br />

These are objects that connect one or more Command objects to a Dataset object..They<br />

provide logic that gets the data from the data store and populates the tables in the DataSet,<br />

or pushes the changes in the DataSet back into the data store.<br />

√<br />

√<br />

An OleDbDataAdapter object is used with an OLE-DB provider<br />

A SqlDataAdapter object uses Tabular Data Services with MS SQL Server.<br />

(B)What are basic methods of Dataadapter ?<br />

There are three most commonly used methods of Dataadapter :-<br />

Fill :- Executes the SelectCommand to fill the DataSet object with data from the data<br />

source. Can also be used to update (refresh) an existing table in a DataSet with changes<br />

176<br />

* Author has Intentionally marked all Database questions as Basic belive me not answering<br />

them will not give a good impression during interviews.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!