Search!!

Loading...

Followers

Jan 10, 2011

Microsoft ADO.NET 2.0 Interview Questions and Answers

Microsoft ADO.NET 2.0 Interview Questions and Answers,Net 2.0 Interview Questions. Interview Questions For ADO.NET,ADO.NET Interview Questions and Answers

Why edit is not possible in repeater?
It has no such feature.


Difference between SqlCommand and SqlCommandBuilder?
a) SQLCommand is used to execute all kind of SQL queries like DML(Insert, update,Delete) & DDL like(Create table, drop table etc)
b)SQLCommandBuilder object is used to build & execute SQL (DML) queries like select, insert, update & delete.

Why can\'t we use Multiple inheritance and garbage collector paralelly in .net?
FYI, .net doesn't support the mutiple inheritance, perhaps you may talk about multi-level inheritance.

In the later case, if a class is inherited from another class, at the time of creating instance, it will obviously give a call to its base class constructor (ie bottom - top approach). Like wise the constructor execution is takes place in top down approach (ie. base class constructor is executed and the derived class constructor is executed).

So for GC, it will collect only when an object does not have any reference. As we see previously, the derived is constructed based on base class. There is a reference is set to be. Obviously GC cannot be collected.

What is ADO.NET?

ADO.NET is the primary relational data access model for Microsoft .NET-based applications. It may be used to access data sources for which there is a specific .NET Provider, or, via a .NET Bridge Provider, for which there is a specific OLE DB Provider, ODBC Driver, or JDBC Driver. ADO.NET is sometimes considered an evolution of ADO technology, but it is important to note that some major changes were made between the two.

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.

How to copy the contents from one table to another table and how to delete the source table in ado.net?
It is possible

DataSet ds;

sqlAdap.Fill(ds);

Datatable dt = ds.Tables[0].copy();

//now the structure and data are copied into 'dt'

ds.Tables.remove(ds.Table[0]);
//now the source is removed from the 'ds'

How to call the SQL commands asynchronously in ADO.NET version 2.0?
executescalar() executereader() executenonquery()
these comes with Begin and End like Beginexecutescalr() Endexecutescalar().......by using these command we can achieve asynch comm in ado.net

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.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.

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);
sqldatareader dr=cmd.executeReader();
if(dr.hasrows)
{
dr.read();
gridview1.DataSource=dr;
gridview1.Databind();
if(dr.nextresult)
{
gridview2.datasource=dr;
gridview2.databind();
}
}
dr.colse();
connection.close();

What's Connection Pooling?
Connection pooling is the ability of re-use your connection to the Database.This means if you enable Connection pooling in the connection object, actually you enable the re-use of the connection to more than one user.The connection pooling is enabled by default in the connection object.If you disable the connection pooling, this means the connection object which you create will not be re-used to any other user than who create that object.


Shall I Enable/Disable Connection pool?
Let's do an example to use what the time has required if we enable/disable the connection pool in an application.

What is different between SqlCommand object and Command Behaviour 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.

CommandBehaviour:-
Provides a description of the results of the query and its effect on the database.
Like,
Command cmd=new Command("SQL",conn,CommandBehaviour.CloseConnection);

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 parant controls,that is called event bubbling,means event is bubbled from bottom(chield)to up(parant).

Once data is fetched into dataset connection gets closed. but in datareader connection
is always maintained...then why datareader is fast and mainly recommended ?
Datareader is forwardonly thus is fast and is mostly used while retrieving the data from the database.


When multiple users attempt to modify data at the same time Ex user 1 is updating record at same.time user2 deleted record sucessfully.now user1 has press update button . how to handle concurrency?

Have one column with in Database table with datatype as TimeStamp and while selecting the row we
will read the TimeStamp value, which we can compare at the time of updation, if both values are same

then we can update that row otherwise we can resist the user from updating saying that someone has updated the row, you can't update it.

What is method to get XML and schema from Dataset?
// Summary:
// Returns the XML representation of the data stored in the System.Data.DataSet.
//
// Returns:
// A string that is a representation of the data stored in the System.Data.DataSet.

// Summary:
// Returns the XML Schema for the XML representation of the data stored in the
// System.Data.DataSet.
//

// Returns:

// String that is the XML Schema for the XML representation of the data stored
// in the System.Data.DataSet.

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

No comments:

Post a Comment

 

Aired : Interview Questions | Certifications | Tutorials | Career Help | Copyright © 2009-2013