

Creating a Windows Forms application and adding controls to the form On the SQL DataAdapter button-click event handler, you'll write code to read data from a SQL Server datasource and fill data to the data grid.įigure 5-40. On the OleDb DataAdapter button-click event handler, you'll write code to read data from an OleDb data source and fill data to the data grid. You can add a button-click event handler either by double-clicking on the button or by using the Events tab of the properties window of a button control. Now add button-click event handlers for both the OleDbDataAdapter and SQL DataAdapter buttons. As you can see, there are two buttons, OleDbDataAdapter and SQL DataAdapter. After setting these properties, the form will look like figure 5-40. Next set the properties to OleDbData Adapter and SQL DataAdapter. Second, set both button's Name property use OleDbDataAdapter and SqlDataAdapter. In this sample example, I'll show you how to create data adapters using Sql and OleDb data providers and fill data from data from data adapter to a DataGrid control.įirst, create a Windows application using Visual Basic projects and add two buttons and a DataGrid control to the form by dragging the controls form the toolbox to the form. Now you'll create your first sample using data adapters.
