Submitted ByUser LevelDate of SubmissionMahesh ChandBeginners06/19/2001
Platform Used: VS.NET Beta 2 (Test Build)Description of the Article:Microsoft Visual Studio .NET (VS.NET afterwards) is full with Data-bound controls and wizards. These controls and wizards help you to generate your applications in no time. You just set some properties of these controls and use wizards to generate your code. In couple of minutes, you develop a full-fledged working application.
In this series of articles, my first article is OleDb Data Adapter Controls in VS.NET. In this article, I'll show you how to display data in a DataGrid control by writing only one line of code. You just follow these simple steps:
Step 1: Create ProjectPick Visual C#->Windows Application project and type your project name and pick a directory.
Step 2: Add OleDb Data Adapter Drag an OleDbDataAdapter control from Toolbox->Data to your form. Data Adapter Configuration Wizard appears and it guides you towards to create your Data Adapter pbject.
First screen is about the wizard.
Second screen will let you create a connection. If you already have connections, they are available in a drop down list. You either pick a connection from your list or create a new connection.
Next page provides you options to use SQL Statements or stored procedures.
Next step is to generate SQL statement. You use Query Builder button to build a query.
This option let you pick your database tables.
And now you pick what columns you want to get data from the database to the DataAdapter.
This page shows you your SQL Statement. You can even write SQL statement by yourself (with no help of Query Builder).
Last page shows you the activities wizard finished.
Step 3: Generate DataSetNext step is to generate DataSet and connect DataSet to a DataView component. You generate a DataSet by using "Generate DataSet" option in DataAdapter's Properties dialog -
Generate DataSet link shows you dataset. Pick "New" option and type your dataset name. You can pick as many as tables you want from the list.