.NET Framework: Work with the Console

This sample shows how to create console applications. 

Featured Highlights:

The code demonstrates how to create a console application. The console application uses SQL Server to read the Northwind database Products table into a dataset. When the console application is run, it accepts input from the user that is either a product id or 'quit'. If quit is entered, the console application ends. If a valid product id (integer format) is entered its associated product information is displayed. If an invalid product id is entered, an exception message is displayed. Users can continue to input product id's until quit is entered.

Requirements:

Running the Sample

Simply press F5.

  1. The How To-Work with the Console solution consists of 2 projects. The startup project is a windows project, How-To Work with the Console, that displays a windows form which will allow a user launch the actual console project. The second project in the solution is the console application, How-To Work with the Console Application, that provides the functionality described in featured highlights.

See Also:

Building Console Applications,  Console Class,  Debugging Preparation: Console Applications