In the previous topic, we added the code that allows the MyData control to provide data to other objects. In this step we'll connect the MyData control to an ADO source and bind to it using both simple and complex binding.
Note This topic is part of a series that walks you through creating sample data source components. It begins with the topic Creating Data Sources.
To test the MyData control
Important If you haven't previously created a DSN for the Northwind database, you'll need to create one first.The procedure for creating a DSN is discussed in "Connection Objects" in "About the Data Environment Designer" in the Data Access Guide.
As you click the buttons on the MyData control, names from the CompanyName field should appear in the TextBox. Try editing a name in the TextBox, then move forward and back to the same record. You'll notice that your change has been saved to the database. The TextBox is simple-bound to the Northwind database by way of the MyData control.
The grid should contain all of the data from the Customers table. As you click the buttons on the MyData control, the selected row in the grid changes to match the data in the TextBox, scrolling as necessary. As with the TextBox, you can edit data in the grid and the changes are saved in the database. The DataGrid is complex-bound to the Northwind database by way of the MyData control.
Important If you haven't previously created a OLE DB connection for the Northwind database, you'll need to create one first.The procedure for creating a DSN is discussed in "Creating the Northwind OLEDB Data Source" in "Using Visual Basic's Standard Controls" in the Programmer's Guide.
You'll see that the data looks and acts exactly like it did before. The data is now being accessed through an OLE DB interface rather than a ODBC interface, and all you had to do was change the connection string!
As long as you have the project open, take some time to play around with other property settings such as BOFAction and EOFAction to see their behavior.
In the next few steps, we'll build a ActiveX DLL and connect our form to an OLE DB Simple Provider.
This topic is part of a series that walks you through creating sample ActiveX data sources.
To | See |
Go to the next step | Creating the MyData Component Project |
Start from the beginning | Creating Data Sources |