Before Applying job posting in any websites or recruiting agencies or sending resumes to job recruiters or any other employment website you need to improve your skills on general knowledge, Aptitude, Puzzles, logical reasoning, general english, database, programming as per your job profile. Job recruiters or mostly preferring job candidates who are having more stuff in those categories mentioned above. So improving more skills on your job profile always boost up your career and your performance. Even hiring companies and job recruiters who are looking for many job posting websites actually they are looking and filtering on these activities. In these section you need to update more questions to perform well in front of job recruiters and companies. Interview questions are most important to score in interview, Update all questions to score well in all rounds in job interview.

ADO.Net interview questions and answers

What are basic methods of Data adapter?

There are three most commonly used methods of Data adapter :
Fill : Executes the Select Command to fill the Dataset object with data from the data source
It can also be used to update (refresh) an Exiting table in a Dataset with changes made to the data in the original data source if there is a primary key in the table in the Dataset.

Fill Schema :Extracts just the Schema for a table from the data source, and creates an empty table in the Dataset object with all the correspondingconstrains.
Update : Updates the original datasource with the changes made to the content of the DataSet.

What are the different components in ADO.NET?

There are 6 important componentsin ADO.NET :

  • Connection : This object creates a connection to the database. If you want to do any operation on the database you have to first create a connection object.
  • Command : This object helps us to execute AQL queries against database. Using command object we can excute select, insert , update and delete SQL command.
  • Data reader : This provides a recordset which can be browsed only in forward direction. It can only by read but not updated . Data reader is good for large number of records where you want to just browse quickly and display it.
  • Dataset object : This provides a recordset which can be read back and in forward direction. The recordset can also be updated. Dataset is like a in memory database with tables, rows and fields.
  • Data Adapter : This object acts as a bridge between database and dataset; it helps to load the dataset object.
  • Data View : This object is used to sort and filter data in Data table of dataset.

What is the use of data adapter ?

Data adapter object asts like a bridge it helps to load the dataset object. Below is a simple code snippet which shows how the dataadapter object is created and then using the fill method the dataset object is loaded.

SqlDataAdapter objAdapter = SqlDataAdapter (objCommand);
DataSet objdataset = new DataSet();
0bjAdapter. Fill(objDataset);

How do we use stored procedure in ADO.NET and how do we provide parameters to the stored procedures?

ADO.NET provides the SqlCommand object, which provides the functionality of executing stored procedures. In the command type we need to provide the command type as stored procedure as shown in the below code snippet.

Sql Command obj Command = new Sql Command (“sp -Insert”, obj Connection);
Obj Command .CommandType = CommandType . StoredProcedure ;
Obj Command . ExeculteNonQuery () ;

How can we force the connection object to close after my data reader is closed?

Command method Execute reader takes a parameter called as Command Behavior wherein we can specify saying close connection automatically after the Data reader is close.

Pobj DataReader = pobjCommand. Execute Reader (CommandBebavior.CloseConnection)