Database Reference
In-Depth Information
Try It: Getting Information About a Result Set with a Data Reader
In this exercise, you'll use some of these methods and properties.
1.
Select the DataReader project, right-click, and choose Add
Windows Form.
From the opened dialog, make sure Windows Form is selected and rename
Form1.cs to ResultSetInfo.cs; then click OK to add this form to the DataReader
project.
2.
Select the ResultSetInfo form, and set the Size property's Width to 462 and
Height to 460.
•
Drag a Label control to the form, select this control, navigate to the
Properties window, and set the following properties:
•
Set the Name property to lblDataType.
•
Set the AutoSize property to false.
•
Set the Location property's X to 3 and Y to 31.
•
Set the Size property's X to 57 and Y to 13.
•
Set the Text property to Data Type.
3.
Drag a Label control to the form. Select this control, navigate to the Properties
window, and set the following properties:
•
Set the Name property to lblType1.
•
Set the AutoSize property to false.
•
Set the Location property's X to 80 and Y to 21.
•
Set the Size property's X to 101 and Y to 34.
•
Leave the Text property blank.
•
Drag a Label control to the form. Select this control, navigate to the
Properties window, and set the following properties:
•
Set the Name property to lblType2.
•
Set the AutoSize property to false.
•
Set the Location property's X to 222 and Y to 21.
•
Set the Size property's X to 101 and Y to 34.
•
Leave the Text property blank.
•
Drag a TextBox control below the Label controls, and navigate to the
Properties windows to configure the following properties:
•
Set the Name property to txtResultSet.
•
Set the Multiline property to True.