www.mobiblues.com

Friday, January 9, 2009

Basic .Net Question

1. What is Assembly name and name space?
An assembly is a logical unit of code. Physically it may exist as .dll or an exe, which can contain one or more files and they can be any file types like image files, text files etc. along with DLLs or EXEs. When you compile your source code by default the exe/dll which is generated is actually an assembly and every assembly file contains information about itself which is called as Assembly Manifest. Namespace is an abstract container providing context for the items it holds and allows disambiguation of items having the same name (residing in different namespaces. It can also be said as a context for identifiers. So under a namespace you can have multiple assemblies.

2. what is capacity of dataset?
ans: DataSet is logical represantation of database so it can store as much as database.

3. What is deployment? How do you deploy .Net and Java applications
ans: Deployment - It is the procedure to deploy Web Application on the Server. You can deploy .Net application by simply Xcopy and create virtual directory for the application on server.

4. Where this DataSet is Stored?
ans: Dataset is an in-memory representation of a database. Its stored no where but in memory. Goes off when GC stats after a littl sleep.

5. How different are interface and abstract class in .Net?
ans: When a class is not provided with full functionalitythen it is declared as abstract.it doesn't support instance creation as well as it cannot be overridable to child class.interface is a colection of methods only without functionality.interface is 90% same as abstract class.

6. Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?
ans: A DataSet can represent an entire relational database in memory, complete with tables, relations, and views.
A DataSet is designed to work without any continuing connection to the original data source.
Data in a DataSet is bulk-loaded, rather than being loaded on demand.
There's no concept of cursor types in a DataSet.
DataSets have no current record pointer You can use For Each loops to move through the data.
You can store many edits in a DataSet, and write them to the original data source in a single operation.
Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.

7.What is ADO.NET?
ans: ADO.NET is a set of classes that expose data access services to the .NET Applications. ADO ( or ActiveX Data Objects ) is an easy-to-use yet extensible technology for adding database connectivity to Web pages. ADO.NET is the next generation of ADO, providing the interface for accessing, manipulating, and exchanging data in the Microsoft .NET Framework.
The ADO.NET components have been designed to factor data access from data manipulation. There are two central components of ADO.NET that accomplish this: the DataSet, and the .NET Framework data provider, which is a set of components including the Connection, Command, DataReader, and DataAdapter objects.

8.What is DataSet?
ans: A DataSet is a cache of records retrieved from a data source. It works like a virtual data store: A dataset includes one or more tables based on the tables in the actual database, and it can include information about the relationships between those tables and constraints on what data the tables can contain.
The DataSet object is central to supporting disconnected, distributed data scenarios with ADO.NET. The DataSet class is explicitly designed for data access independent of any data source. As a result it can be used with multiple and differing data sources, used with XML data, or used to manage data local to the application. The DataSet contains a collection of one or more DataTable objects made up of rows and columns of data, as well as primary key, foreign key, constraint, and relation information about the data in the DataTable objects.

9.Explain How ADO.NET Works?
ans: ADO.NET uses two types of objects to access the data in a database: datasets, which can contain one or more data tables, and .NET data provider objects, which include data adapters, commands, and connections. A dataset stores data from the database so that it can be accessed by the application. The .NET data provider objects retrieve data from and update data in the database.

To retrieve data from a database and store it in a data table, a data adapter object issues a Select statement that stored in a command object. Next, the command object uses a connection object to connect to the database and retrieve the data. Then, the data is passed back to the data adapter, which stores the data in the dataset. To update the data in a database based on the data in a data table, the data adapter object issues an Insert, Update, or Delete statement thats stored in a command object. Then, the command object uses a connection to connect to the database and update the data.

10.What are the main classes/Components of ADO.NET?
ans: ADO.NET is comprised of many classes, but five take center stage: Connection Represents a connection to a data source. Command Represents a query or a command that is to be executed by a data source.

DataSet Represents data. The DataSet can be filled either from a data source (using a DataAdapter object) or dynamically. DataAdapter Used for filling a DataSet from a data source. DataReader Used for fast, efficient, forward-only reading of a data source.


11.Explain the Use of connection pooling in ADO.NET
ans: Connection pooling enables an application to use a connection from a pool of connections that do not need to be re-established for each use. Once a connection has been created and placed in a connection pool, an application can reuse that connection without performing the complete connection creation process. By default, the connection pool is created when the first connection with a unique connection string connects to the database. The pool is populated with connections up to the minimum pool size. Additional connections can be added until the pool reaches the maximum pool size.

When a user request a connection, it is returned from the pool rather than establishing new connection and, when a user releases a connection, it is returned to the pool rather than being released. But be sure than your connections use the same connection string each time. Here is the Syntax conn.ConnectionString = "integrated Security=SSPI; SERVER=192.168.0.123; DATABASE=MY_DB; Min Pool Size=4;Max Pool Size=40;Connect Timeout=14;";

12.How can you search the Data in DataSet?
ans: Searching for Data in the DataSetWhen querying a DataSet for rows that match particular criteria, you can increase the performance of your searches by taking advantage of index-based lookups. When you assign a PrimaryKey value to a DataTable, an index is created. When you create a DataView for a DataTable, an index is also created. Here are a few tips for taking advantage of index-based lookups.

13.How can you update Database using DataAdapter and the DataSet?
ans: Updating the Database with a DataAdapter and the DataSet The Update method of the DataAdapter is called to resolve changes from a DataSet back to the data source. The Update method, like the Fill method, takes as arguments an instance of a DataSet, and an optional DataTable object or DataTable name. The DataSet instance is the DataSet that contains the changes that have been made, and the DataTable identifies the table from which to retrieve the changes.
When you call the Update method, the DataAdapter analyzes the changes that have been made and executes the appropriate command (INSERT, UPDATE, or DELETE). When the DataAdapter encounters a change to a DataRow, it uses the InsertCommand, UpdateCommand, or DeleteCommand to process the change.

0 comments:

Post a Comment