Anda di halaman 1dari 8


Can we connect two datareader to same data source using single connection at same time? The point is, we can have any number of datareaders to the same datasource, but only one of them could have an active connection at any point of time.

2. What is the difference between ADO and ADO.NET? 1.Ado is created using COM technology,whereas is implemented by using .NET framework technology. 2.In ADO we can store only one table,whereas in we can store multiple tables in the dataset. 3.In ADO we can't generate relations whereas in ADO.NET we can generate relations. 4.In ADO we can't generate SQL statements whereas in ADO.NET we can generate SQL statements. 5.ADO is connection-oriented,but ADO.NET is connectionless.


Difference between SqlCommand and SqlCommandBuilder sqlcommand is used to execute query whereas commandbuilder we cannot type the full querye like update,insert it will automatically take the query How do I insert records using data reader? A Data Reader is a Forword Only and Read Only Cursor, which is use to fetch data from the database. It cannot be use to Insert any data. What is the difference between data reader and data adapter. DateReader is an forward only and read only cursor type if you are accessing data through DataRead it shows the data on the web form/control but you can not perform the paging feature on that record(because it's forward only type). Reader is best fit to show the Data (where no need to work on data) DataAdapter is not only connect with the Databse(through Command object) it provide four types of command (InsertCommand, UpdateCommand, DeleteCommand, SelectCommand), It supports to the disconnected Architecture of .NET show we can populate the records to the DataSet. where as Dataadapter is best fit to work on data.




How do I read data (or records) from database using data reader? To read data from the database, you first make a connection object (SqlConnection, etc) and open it. C# Version string connString = "server=FARAZ; database=programmersheaven;" + "uid=sa; pwd="; SqlConnection conn = new SqlConnection(connString); conn.Open(); string cmdString = "select * from author"; SqlCommand cmd = new SqlCommand(cmdString, conn);


What are good ADO.NET object(s) to replace the ADO Recordset object? In ADO, the in-memory representation of data is the Recordset. In, it is the dataset A recordset looks like a single table in ADO In contrast, a dataset is a collection of one or more tables in ADO is designed primarily for connected access the disconnected access to the database is used


How to copy the contents from one table to another table and how to delete the source table in In sql we can copy data from one table to anouther by sqlbulckcopy object but the destination table have same schema if the process is successful, execute the drop table query.


How can we load multiple tables in to Dataset?

we can load multiple table ina single dataset by this code SqlDataAdapter dap=new SqlDataAdapter(<query1>,<connection>); DataSet ds=new DataSet(); dap.fill(ds,"<tablename1>"); dap.fill(ds,"<tablename2>");

10. What is the Dot Net Framework data provider for SQL Server?

The dot net framework data provider for SQL Server. We can access it using the namespace System.Data.SqlClient. From there we can access the provider classes:SqlConnection, SqlCommand, SqlParameter, SqlTransaction. SqlDataReader, SqlDataAdapter.

11. What is the Dot Net Framework data provider for OLEDB? The dot net framework data provider for OLEDB provides connectivity with the OLEDB supported database management systems. It is the recommended middle tier for the SQL Server 6.5 or earlier and Microsoft Access Database. It is a general data provider. You can also use it to connect with the SQL Server or Oracle Database Management Systems. The classes for this provider are present in the System.Data.OleDBClient namespace 12. Explain LINQ to Entities? This feature allows LINQ query capabilities and it specifically forms a part of the .NET framework. This feature allows developers to program in ADO.NET and ORM. This feature also allows access to third party database. This provides new features to entity data.

13. What is a dataset? dataset is class of using;it is used to store the multiple table and is called disconnected architecture and used to fill the table in dataset using dataadapter. 14. How do I write common code for different dot net framework data providers?

Create your own Layer using the data Interface and instantiate the appropriate data providers as and when required. IDbConnection, IDbCommand, IDbDataAdapter, IDataReader, IDbTransaction. Create a Base class say for example: BaseDataProvider.cs and use the above mentioned Interfaces. In App.Config file, Create the Key DataBase ? 1 Value=? MQSQLServer?, 2 ? for Oracle and So on. And based on the Database type, return the appropriate DataProvider Object.

15. How to select data set or data reader?

16. How do I find the connection string for the database server? Usually the connection string options are provided in the documentation, you can also find the connection strings on the internet. A good website for the connections strings is

17. What is ADO.Net? Most of the today?s applications need to interact with database systems to persist, edit or view data. In .Net data access service is provided through ADO.Net (ActiveX Data Object in Dot Net) components. ADO.Net is an object oriented framework that allows you to interact with database systems. We usually interact with database systems through SQL queries or stored procedures. ADO.Net encapsulates our queries and commands to provide a uniform access to various database management systems. 18. What does it mean by disconnected data access architecture of ADO.Net?

ADO.Net introduces the concept of disconnected data architecture. In traditional data access components, you make a connection to the database system and then interact with it through SQL queries using the connection. The application stays connected to the DB system even when it is not using DB services. This commonly wastes the valuable and expensive database resource as most of the time applications only query and view the persistent data. ADO.Net solves this problem by managing a local buffer of persistent data called data set. Your application automatically connects to the database server when it needs to pass some query and then disconnects immediately after getting the result back and storing it in dataset. This design of ADO.Net is called disconnected data architecture and is very much similar to the connection less services of http over the

internet. It should be noted that ADO.Net also provides the connection oriented traditional data access services.

19. How do I solve the deployment issues (mentioned in the previous FAQ)?

20. What is a data adapter?

A data adapter is the component that exists between the local repository (dataset) and the physical database. It contains the four different commands (SELECT, INSERT, UPDATE and DELETE). It uses these commands to fetch the data from the DB and fill into the dataset and to perform updates done in the dataset to the physical database. It is the data adapter that is responsible for opening and closing the database connection and communicates with the dataset. 21. How to find the given query is optimised one or not? Using the power of the SQL Profiler and running a simple trace to capture the performance of your stored procedures can easily obtain these query lists. that needs tuning. 22. What is the Dot Net Framework data provider for Oracle? The dot net framework data provider for Oracle is the optimized data provider for Oracle DBMS. It is recommended to use Oracle data provider to access the Oracle DB than general provider like OLEDB. It supports the Oracle Client version 8.1.7 and later. The classes for this provider are present in the System.Data.OracleClient namespace. 23. Does SQLClient and OLEdb class share the same functionality

No, each have its own functionality, ex : for sql client , there is SqlConnection object

and for oledb client , there is OleDBConnection

24. How do I save the changes, made in the dataset, to the database? We update the dataset and table by calling the Update method of the data adapter. This saves the changes in the local repository of data: dataset. To save the changed rows and tables to the physical database, we call the AcceptChanges() method of the DataSet class. C# Version dataAdapter.Update(ds, "student"); ds.AcceptChanges();

25. What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET?

SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft. OLE-DB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix, but it is a .NET layer on top of OLE layer, so not the fastest thing in the world. ODBC.NET is a deprecated layer provided for backward compatibility to ODBC engines.

26. Explain about Data services?

ADO.NET has number of combinations of patterns and resources of libraries. This creates a feature which integrates data services with web. It contains formats which represent data such as JSON and plain XML. This form of interaction enables developers to interact with normal http commands.

27. Explain about ADO.NET and its features?

Active X data objects are used to access data sources and it is based upon the Component object model. This technology allows data base developers to write program without the knowledge of how database is implemented. Knowledge of SQL is absolutely not necessary to write programs in ADO. Features:ADO.NET features are included in the Microsoft.NET framework. It has software components which help in data access and services. This can be used to make changes to RDBMS and non relational data base systems. This technology is considered to be the forefront of Active X data objects.

28. Explain about command builder class feature? Implementation of INSERT, DELETE and UPDATE commands is automatic and this class provides the necessary automation. You cannot extend or change the command builder while keeping the base algorithm intact to create action statements.

29. How can you find a problem in the data stack? Problem can arise from these following instances they are: 1) Mismatch of schema between the client and database. 2) Network library problems or non existence of data. 3) Wrong SQL generated. 4) Wrong programming logic.


Explain about Active X data objects? Active X data objects are used to access data sources and it is based upon the Component object model. This technology allows data base developers to write program without the knowledge of how database is implemented. Knowledge of SQL is absolutely not necessary to write programs in ADO.

31. Explain about the relationship of XML and ADO.NET? ADO.NET utilizes the power of XML by providing disconnected access to data. This is designed with the help of XML classes in .NET Framework which form the components of single architecture.

32. What are the different languages which implement ADO?

There are several languages which implement ADO technology out of which these are some of the basic they are VB script in ASP, Visual Basic, Delphi, C++, and Microsoft environments. ADO.NET is a new addition to ADO.

33. How do I create a command and supply the SQL query to ADO.Net? (Command object and command string)
First of all, you create a command object (SqlCommand, OracleCommand, OleDbCommand, OdbcCommand) using the connection object (SqlConnection, OracleConnection, OleDbConnection, OdbcConnection) and set its CommandText property to the SQL query to execute. C# Version OdbcCommand cmd = conn.CreateCommand(); cmd.CommandText = "select * from authors";

34. Why edit is not possible in repeater??

35. Explain about data provider? 36. How do different components of ADO.Net interact with each other in disconnected architecture? The Data Adapter contains in it the Command and Connection object. It uses the connection object to connect to the database, execute the containing command, fetch the result and update the DataSet.

37. What is the difference between data reader & data set

38. What is a stored procedure? 39. What does it mean by Dot Net Framework Data Provider?

40. Name some of the top level objects which ADO consists?