Você está na página 1de 7

ADO.

Net Interview Question and Answers


1. What is Ado.NET?

ADO.NET is an object-oriented set of libraries that allows you to interact with data sources. ADO.NET is a set of classes that expose data access ser ices to the .NET pro!ra""er. ADO.NET is also a part of the .NET #ra"ewor$. ADO.NET is used to handle data access.

2. What are the two funda"ental objects in ADO.NET? There are two funda"ental objects in ADO.NET. Datareader - connected architecture and Dataset - disconnected architecture. 3. What are the data access na"espaces in .NET?

The "ost co""on data access na"espaces % &yste".Data &yste".Data.OleDb &yste".Data.&'()lient &yste".Data.&'(Types &yste".Data.*+(

4. What are "ajor difference between classic ADO and ADO.NET? ,n ADO the in-"e"ory representation of data is the recordset.A -ecordset object is used to hold a set of records fro" a database table. ,n ADO.NET we ha e dataset.A Data&et is an in "e"ory representation of data loaded fro" any data source. 5. what is the use of connection object in ado.net? The ADO )onnection Object is used to create an open connection to a data source. Throu!h this connection. you can access and "anipulate a database. 6. What are the benefits of ADO.NET?

&calability Data &ource ,ndependence ,nteroperability &tron!ly Typed #ields

/erfor"ance

7. What is a )lustered ,ndex? The data rows are stored in order based on the clustered index $ey. Data stored is in a se0uence of the index. ,n a clustered index. the physical order of the rows in the table is the sa"e as the lo!ical 1indexed2 order of the $ey alues. A table can contain only one clustered index. A clustered index usually pro ides faster access to data than does a non-clustered index. 8. What is a Non-)lustered ,ndex? The data rows are not stored in any particular order. and there is no particular order to the se0uence of the data pa!es. ,n a clustered index. the physical order of the rows in the table is not sa"e as the lo!ical 1indexed2 order of the $ey alues. 9. Whate are different types of )o""ands a ailable with DataAdapter ?

The &0lDataAdapter has &elect)o""and ,nsert)o""and Delete)o""and 3pdate)o""and


1 . What is the difference between an ADO.NET Dataset and an ADO -ecordset? Dataset can fetch source data fro" "any tables at a ti"e. for -ecordset you can achie e the sa"e only usin! the &'( joins. A Data&et can represent an entire relational database in "e"ory. co"plete with tables. relations. and iews. A -ecordset can not. A Data&et is desi!ned to wor$ without any continues connection to the ori!inal data source4 -ecordset "aintains continues connection with the ori!inal data source. Data&ets ha e no current record pointer. you can use #or Each loops to "o e throu!h the data. -ecordsets ha e pointers to "o e throu!h the".

11.

Which "ethod do you in o$e on the DataAdapter control to load your !enerated dataset with data? DataAdapter5 fill 12 "ethod is used to fill load the data in dataset.

12. What are the different "ethods a ailable under s0lco""and class to access the data?

E!e"ute#eader - 3sed where one or "ore records are returned - &E(E)T 'uery. E!e"uteNonQuer$ - 3sed where it affects a state of the table and no data is bein! 0ueried - ,N&E-T. 3/DATE. DE(ETE. )-EATE and &ET 0ueries. E!e"ute%"a&ar - 3sed where it returns a sin!le record.

13. What is a Data&et? A Data&et is an in "e"ory representation of data loaded fro" any data source. 14. What is a DataTable? A DataTable is a class in .NET #ra"ewor$ and in si"ple words a DataTable object represents a table fro" a database. 15. What is the data pro ider na"e to connect to Access database? +icrosoft.Access 16. Which na"espaces are used for data access?

&yste".Data &yste".Data.OleD6 &yste".Data.&'()lient

17. What is difference between Dataset. clone and Dataset.copy? '&one% - ,t only copies structure. does not copy data. 'o($% - )opies both structure and data. 18. What is difference between dataset and datareader?

Data-eader pro ides forward-only and read-only access to data. while the Data&et object can hold "ore than one table 1in other words "ore than one rowset2 fro" the sa"e data source as well as the relationships between the". Dataset is a disconnected architecture while datareader is connected architecture. Dataset can persist contents while datareader can not persist contents. they are forward only.

19. What is DataAdapter? A data adapter represents a set of "ethods used to perfor" a two-way data updatin! "echanis" between a disconnected DataTable and the database. ,t a!!re!ates four co""ands% select. update. insert and delete co""and. One adapter can only !enerate and fill one table in a Data&et. 2 . What is a )o""and Object? The ADO )o""and object is used to execute a sin!le 0uery a!ainst a database. The 0uery can perfor" actions li$e creatin!. addin!. retrie in!. deletin! or updatin! records. 21. What is basic use of Data7iew? 8Data7iew9 represents a co"plete table or can be s"all section of rows dependin! on so"e criteria. ,t is best used for sortin! and findin! data with in 8datatable9. 22. What is the use of )onnection Object?

The ADO )onnection Object is used to create an open connection to a data source. Throu!h this connection. you can access and "anipulate a database. 23. What are the ad anta!e of ADO.Net?

Database ,nteractions Are /erfor"ed 3sin! Data )o""ands Data )an 6e )ached in Datasets Datasets Are ,ndependent of Data &ources Data ,s /ersisted as *+(.

24. What is a stored procedure? A stored procedure is a preco"piled executable object that contains one or "ore &'( state"ents. A stored procedure "ay be written to accept inputs and return output 25. What is the difference between O(ED6 /ro ider and &0l)lient ? &'()lient .NET classes are hi!hly opti"i:ed for the .net ; s0lser er co"bination and achie e opti"al results. The &0l)lient data pro ider is fast. ,t<s faster than the Oracle pro ider. and faster than accessin! database ia the OleDb layer. 26. What is the use of /ara"eter Object? ,n ADO /ara"eter object pro ides infor"ation about a sin!le para"eter used in a stored procedure or 0uery. 27. What is DataAdapter? Data&et contains the data fro" the DataAdapter which is the brid!e between the Data&et and Database. DataAdapter pro ides the way to retrie e and sa e data between the Data&et and Database. ,t acco"plishes this by "eans of re0uest to the &'( )o""ands "ade a!ainst the database. 28. What does ADO "ean? ADO stands for Actice* Data Objects.,t was introduced few years a!o as a solution to accessin! data that can be found in arious for"s. not only o er a (AN but o er the internet. ,t replaced the data access technolo!ies -DO1-e"ote Data Objects2 and DAO 1Data Access Objects2. 29. Na"e so"e ADO.NET Objects?

)onnection Object Data-eader Object )o""and Object Data&et Object DataAdapter Object

3 . What is Data /ro ider? A set of libraries that is used to co""unicate with data source. E!% &'( data pro ider for &'(. Oracle data pro ider for Oracle. O(E D6 data pro ider for access. excel or "ys0l. 31. What is the DataTable)ollection? An ADO.NET Data&et contains a collection of :ero or "ore tables represented by DataTable objects. The DataTable)ollection contains all the DataTable objects in a Data&et. 32. What are the benefits of ADO.NET? ADO.NET offers se eral ad anta!es o er pre ious ersions of ADO and o er other data access co"ponents. These benefits fall into the followin! cate!ories% ,nteroperability +aintainability /ro!ra""ability /erfor"ance &calability

33. =ow to creatin! a &0l)onnection Object? &0l)onnection conn > new &0l)onnection1?Data &ource>Database&er er4,nitial )atalo!>Northwind43ser ,D>@our3ser,D4/assword>@our/assword?24 34. =ow to creatin! a &0l)o""and Object? ,t ta$es a strin! para"eter that holds the co""and you want to execute and a reference to a &0l)onnection object. &0l)o""and c"d > new &0l)o""and1?select )ate!oryNa"e fro" )ate!ories?. conn24 35. =ow to load "ultiple tables into dataset? &0lDataAdapter da > new &0lDataAdapter1?&elect A fro" ,d4 &elect A fro" &alry?. "ycon24 da.#ill1ds24 ds.TablesBCD.TableNa"e > ?,d?4 ds.TablesBED.TableNa"e > ?&alary?4 36. What is the pro ider and na"espaces bein! used to access oracle database? syste".data.oledb 37. What is the difference between &0l)o""and and &0l)o""and6uilder? &'()o""and is used to retrie e or update the data fro" database. &'()o""and6uilder object is used to build F execute &'( 1D+(2 0ueries li$e select insert updateF delete. 38. What is the use of &0l)o""and6uilder? &'( )o""and6uilder object is used to build F execute &'( 1D+(2 0ueries li$e select insert updateF delete.

39. What are "ana!ed pro iders? A "ana!ed pro ider is analo!ous to OD6) dri er or O(ED6 pro ider. ,t perfor"s operation of co""unicatin! with the database. ADO.NET currently pro ides two distinct "ana!ed pro iders. The &'( &er er "ana!ed pro ider is used with &'( ser er and is a ery efficient way of co""unicatin! with &'( &er er. O(ED6 "ana!ed pro ider is used to co""unicate with any O(ED6 co"pliant database li$e Access or Oracle. 4 . =ow do , delete a row fro" a DataTable? ds.Tables1?dataGtableGna"e?2.-ows1i2.Delete dsc"d.update1ds.?dataGtableGna"e?2 41. What inside in Data&et? ,nside Data&et "uch li$e in Database. there are tables. colu"ns. constraints. relationships. iews and so forth. 42. Explain ADO.Net Architecture? ADO.NET pro ides the efficient way to "anipulate the database. ,t contains the followin! "ajor co"ponents. E. Data&et Object H. Data /ro iders % )onnection Object )o""and Object Data-eader Object DataAdapter Object.

43. What is the difference between int and intIH? 6oth are sa"e. &yste".,ntIH is a .NET class. ,nt is an alias na"e for &yste".,ntIH. 44. What is the role of the Data-eader class in ADO.NET connections? ,t returns a read-only. forward-only rowset fro" the data source. A Data-eader pro ides fast access when a forward-only se0uential read is needed. 45. What are ad anta!es and disad anta!es of +icrosoft-pro ided data pro ider classes in ADO.NET? &'(&er er.NET data pro ider is hi!h-speed and robust. but re0uires &'( &er er license purchased fro" +icrosoft. O(E-D6.NET is uni ersal for accessin! other sources. li$e Oracle. D6H. +icrosoft Access and ,nfor"ix. O(E-D6.NET is a .NET layer on top of the O(E layer. so it5s not as fastest and efficient as &0l&er er.NET. 46. What are acid properties?

Ato"icity )onsistency ,solation

Durability

47. What is Data-ow)ollection? &i"ilar to DataTable)ollection. to represent each row in each Table we ha e Data-ow)ollection. 48. What is the use of Ado.net connection? Establishes a connection to a specific data source. 49. What are basic "ethods of Dataadapter?

#ill #ill&che"a 3pdate

5 . What are the arious "ethods pro ided by the dataset object to !enerate *+(? #ead)*+ % -ead5s a *+( docu"ent in to Dataset. ,et)*+ % This is a function which returns the strin! containin! *+( docu"ent. -rite)*+ % This writes a *+( data to dis$. 51. What is Data&et Object? Dataset is a disconnected. in-"e"ory representation of data. ,t can contain "ultiple data table fro" different database. 52. What is difference between Opti"istic and /essi"istic loc$in!? ,n .essi/isti" loc$in! when user wants to update data it loc$s the record and till then no one can update data. Other user5s can only iew the data when there is pessi"istic loc$in! ,n O(ti/isti" loc$in! "ultiple users can open the sa"e record for updatin!. thus increase "axi"u" concurrency. -ecord is only loc$ed when updatin! the record. 53. What is Execute Non 'uery? The ExecuteNon'uery12 is one of the "ost fre0uently used "ethod in &0l)o""and Object. and is used for executin! state"ents that do not return result sets 1ie. state"ents li$e insert data . update data etc.2. 54. What pro iders does Ado.net uses? The .NET #ra"ewor$ pro ides "ainly three data pro iders. they are +icrosoft &'( &er er. O(ED6. OD6).

Você também pode gostar