Chapter 18 Quick Reference


Chapter 18 Quick Reference

To

Do this

Establish a connection to a database

Click the Add New Data Source command on the Data menu, and then use the Data Source Configuration Wizard to browse to the database for you want to provide access by building a connection string.

Create a dataset

Using the Data Source Configuration Wizard, specify a name for the dataset in the DataSet Name box, expand the Tables node in the tree view of your database presented by the wizard, and then specify the tables and fields that you want to include in your dataset. (A dataset need not include all database tables and fields.)

Create bound objects capable of displaying data from a dataset on a Windows form

After running the Data Source Configuration Wizard, open the Data Sources window, and drag tables and/or fields to the Windows form. To control the type of bound control created by Visual Studio for a table or field, click its arrow and select a control from the list box before dragging it. If you placed a control on the form before adding data sources to the project, bind a database object to the control by the dragging the database objects from the Data Sources window onto the control on the form. Alternatively, set an object's DataBinding properties to a valid field (column) in the dataset. (One of the most useful DataBinding properties is Text.)

Add navigation controls to a Windows form

In Visual Studio 2005, a navigation toolbar is added automatically to Windows forms when a valid database object is dragged from the Data Sources window to the form. To customize the buttons on this toolbar, right-click the InstructorBindingNavigator object in the component tray, and then click Edit Items.

Format database information on a form

Use a MaskedTextBox control to format the content of string data in the dataset. The MaskedTextBox control offers many useful input masks and the ability to create custom string formats.

Filter or sort database information stored in a dataset

Use SQL statements to create custom queries in the Visual Studio Query Builder, and add these queries to a toolbar on a Windows form.



Microsoft Visual Basic 2005 Step by Step
Microsoft Visual Basic 2005 Step by Step (Step by Step (Microsoft))
ISBN: B003E7EV06
EAN: N/A
Year: 2003
Pages: 168

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net