Most Asked ADO.NET Interview Questions and Answers
What is data access layer?
Data Access layer is actually a part of Architecture layer. It has 2 tier,3 tier or N tier Layer. Generally we use 3 tier Layer 1) Presentation layer,Business Logic layer and then Data Access Layer. Data Access layer is a medium to talk between database and Business Logic layer.
It helps to maintain flexibility,resuablity and even secuity also. In security SQL Injection can be stopped with 3 iter Archietcture.
If a table contains 20000 records . In a page at each time 100 records to be displayed. What are the steps u will take to improve performance? will you use dataset or datareader?
we have to use a dataset because on using datareader forward only paging can be achieved.
Suppose if you are at 1000 page and you want to go back to 999th page, if you use datareader it cannot be achieved, since it does not support backward navigation.
Dataset supports forward and backward navigation.
what is bubbled event can u pls explain?
All heavy controls like grid view,datagrid or datalist,repeater controls contains the child controls like button or link button, when we click this button then the event will be raised, that events are handled by parent controls,that is called event bubbling,means event is bubbled from bottom(child)to up(parent).
What is different between SqlCommand object and Command Behavior Object?
DO.NET Command Object – The Command object is similar to the old ADO command object.
It is used to store SQL statements that need to be executed against a data source.
The Command object can execute SELECT statements, INSERT, UPDATE, or DELETE statements, stored procedures, or any other statement understood by the database.
Can dataReader hold data from multiple tables?
data reader can hold data from multiple tables and datareader can hold more than one table.
string query=”select * from employee; select * from student”;
sqlcommand cmd=new sqlcommand(query, connection);
I loaded the dataset with a table of 10 records. One of the records is deleted from the backend, How do you check whether all the 10 records were present while updating the data(Which event and steps) and throw the exception.
By Using the Transactions we can check the Exact Numbers of the rows to be updated and if the updation fails then the Transaction will be rollbacked.
what is typed and untyped dataset?
A DataSet can be Typed or Untyped. The difference between the two lies in the fact that a Typed DataSet has a schema and an Untyped DataSet does not have one. It should be noted that the Typed Datasets have more support in Visual studio.
How to call the SQL commands asynchronously in ADO.NET version 2.0?
these comes with Begin and End like Beginexecutescalr() Endexecutescalar()…….
by using these command we can achieve asynch comm in ado.net
How to copy the contents from one table to another table and how to delete the source table in ado.net?
it is possible
Datatable dt = ds.Tables.copy();
//now the structure and data are copied into ‘dt’
//now the source is removed from the ‘ds’
How to find the given query is optimised one or not?
First Excute Sql Quries in Query Analzer,see How much time 2 take Excute , if Less then the ur desired Time, then it will Optimize query