This sample consist in 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.
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 TaquerĦa AROUT Around the Horn BERGS Berglunds snabbkp BLAUS Blauer See Delikatessen BLONP Blondesddsl pre et fils BOLID B˘lido 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.
This application shows how to interact with a database. First the connection to the database is open (create my_sql_connection.make_from_connection_string (my_database)), then a request to the database is made (create my_sql_command.make_from_cmd_text_and_connection (my_command, my_sql_connection)). Finally, the result of the request is displayed.
This sample contains the following class:
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.