More properties

Now that we have a basic search working doing more is just a matter of adding columns to the typed DataSet using the Wizard and building appropriate SQL queries. To retrieve rows you need the SELECT command which in general is:

The biggest problem is discovering what properties are available. In principle you should be able to work with all of the "shell" properties which you can find listed at the Microsoft website (search for "Shell Properties"). In practice not all of them work and you simply have to use trial and error to see which do.

As an example of extending the search to additional properties change the definition of the DataAdaptor to read:

This returns three columns, two strings (FileName and ItemPathDisplay) and a Date (DateCreated).

For this to work we need to modify the definition of the strongly typed DataSet. All you have to do is use the DataSet Designer to add the two new columns, making sure to use the exact names.

In addition you also have to set the DataType property of System.DateCreated to System.DateTime – you can pick this from the drop down list in the Properties window. In general you have to set the DataType and perhaps additional properties for any new columns you add unless the defaults happen to work. When you leave the Designer the definition of the DateSet is updated to include the new columns as appropriate new typed properties.

In many cases this is all you have to do but if you have controls bound to the typed DataSet then you need to regenerate the controls.

In the case of a Windows Forms project you need to go to the Form Designer and delete DataSet and the BindingSource controls – named searchResults and tableBindingSource in this case- and then rebind the grid to Table in the DataSet.

In the case of a WPF project the procedure is the same but after recreating the DataGrid you have to make the same modifications as needed in the earlier example and you have to add the extra columns.