[[Property:title|ADO.NET Sample]] [[Property:weight|0]] [[Property:uuid|45d24893-63d0-c2a9-9f62-ead08ca4b901]] This sample consist of a command line showing how to interact with a database. The DataReader object is somewhat synonymous with a read-only/forward-only cursor over data. The DataReader API supports flat as well as hierarchical data. A DataReader object is returned after executing a command against a database. The format of the returned DataReader object is different from a recordset. For example, you might use the DataReader to show the results of a search list in a web page. ==Compiling== To compile the example: # Launch EiffelStudio. # Select '''Use existing Ace (control file)''' and click '''OK''' # Browse to ''$ISE_EIFFEL\examples\dotnet\ado\ado3\'' # Choose the Ace file for the version of the .net framework you are running # Choose the directory where the project will be compiled, by default the same directory containing the Ace file. # Click '''OK'''. ==Running== After you launch the sample, the following output appears: Customer ID Company Name ALFKI Alfreds Futterkiste ANATR Ana Trujillo Emparedados y helados ANTON Antonio Moreno Taquera AROUT Around the Horn BERGS Berglunds snabbkp BLAUS Blauer See Delikatessen BLONP Blondesddsl p`re et fils BOLID Blido Comidas preparadas BONAP Bon app' BOTTM Bottom-Dollar Markets BSBEV B's Beverages CACTU Cactus Comidas para llevar CENTC Centro comercial Moctezuma CHOPS Chop-suey Chinese COMMI Comrcio Mineiro CONSH Consolidated Holdings DRACD Drachenblut Delikatessen DUMON Du monde entier EASTC Eastern Connection ... ... ... WILMK Wilman Kala WOLZA Wolski Zajazd When the display is finished, the application wait for you to pressed the return key to finish the application. ==Under the Hood== This application shows how to interact with a database. First the connection to the database is opened: create connection.make ("server=(local)\NetSDK;Trusted_Connection=yes;database=northwind") Then a request to the database is made: create command.make ("select * from customers", connection) connection.open reader := command.execute_reader Finally, the result of the request is displayed: from ok := reader.read until not ok loop io.put_string (reader.item ("CustomerID").to_string) io.put_string ("%T%T") io.put_string (reader.item ("CompanyName").to_string) io.new_line ok := reader.read end This sample uses the following ADO.NET classes: * SQL_DATA_READER * SQL_CONNECTION * SQL_COMMAND ==Notes== This sample is translated from the example located in the QuickStart\howto\samples\adoplus subdirectory of the .NET Framework SDK samples directory of Microsoft Visual Studio .NET.