Search | Contact | Link To Us  

      ASP.NET      

ASP.NET
Dev Environment
Web Forms
Web Controls
ADO .NET
Web User Controls
Deployment
XML Web Services
ASP.NET Feedback Form
Resources
Discussions
VB .NET
About



Advertisement






















































































































     HomeASP.NETADO .NET> Data Adapter Configuration Wizard 

Data Adapter Configuration Wizard

The DataAdapter Configuration wizard let's you customize your data adapter as you want, like displaying the whole table or displaying selected columns from the table and so on. To start, open a new database in Access, name it as books,  create a table, Table1 with some fields in it and save the database in the C: drive of your machine. To start creating your own DataAdapter, open a blank form and add a button (Button1) and a DataGrid control to it from the toolbox. Our intention here is to display the table or some columns in the table which we created in Access in the DataGrid control when Button1 is clicked. To do that, click on the Data tab in the toolbox and double-click OleDbDataAdapter object. We are using OleDbDataAdapter here as we are working with an OleDb data source. After you select OleDbDataAdapter from the data tab in the toolbox it gets added to the component tray beneath the Web Forms designer and opens the Data Adapter Configuration wizard dialog box which looks like the image below.

Click the Next> button in the Data Adapter Configuration wizard to select the data connection you want to use. The dialog box that opens up look like the image below.


Since we are working with our own table, select the New Connection button in that dialog box which opens up the Data Link properties dialog. The Data Link Properties dialog looks like the image below.

In the Data Link properties dialog click the Provider tab and select "Microsoft Jet 4.0 OLE DB Provider" from the list of available providers. After selecting the provider from the Provider tab click Next> button to take you to the Connection tab. Click on the ellipse where it says "Select or enter a database name" and browse for the database on the local drive. Since we are working with our own database (Books.mdb) located on the C: drive, select that. Click on the "Test Connection" button to test the connection and if the connection succeeds, click OK. Clicking OK displays a dialog box like the image below.

It's here where we will generate the SQL Statement we use with this data adapter. Click next on this dialog box which takes you to another dialog like the image below.

It's here where we build our SQL Queries. To build your query click the Query Builder button on this dialog. Once you click that button, the Query Builder dialog opens with a list that displays all the tables in the database with which we are working. In this case it displays only one table as we created only one table in the books database. The Query Builder dialog looks like the image below. Select Table1 in this dialog and click Add to add Table1 to the Query Builder dialog. You can select entire table to be displayed in the DataGrid or just some columns. To display entire table in the DataGrid select the checkbox named "All Columns" in the small dialog named "Table1" which automatically builds the SQL statement for us. If you want to display specific columns from the table in the DataGrid, check on the columns you want to display. Once you finish with that, click next. 

The dialog that opens when you click next looks like the image below.

This dialog lists the configuration of the data adapter and lists the results. Click finish to close the Data Adapter Configuration wizard.

Continue Reading>>

  Privacy Policy | Terms of Use | Site Map | Contact

  © 2004-2010 Startvbdotnet.com. All rights reserved.