Microsoft provides a number of data source objects with Internet Explorer (version 4.0 and later) that can help you display data on a Web page. A data source object can be implemented as an ActiveX object through the use of the HTML object tag. One of these data source objects, the Tabular Data Control, provides data binding for delimited text files. This means that you now have a way to use the ancient text files provided by people and companies still using versions of BASIC from the dawn of the personal computer era. Just in case you don’t remember your ancient history, these are the files with the fields delimited by commas, like the one shown in Listing A. With the Tabular Data Control data source object, it is possible to bring this data—if not the people (or their taste in music)—out of the 1970s.
The Tabular Data Control in action
Using the Tabular Data Control data source object requires at least two properties, DataURL and UseHeader. The DataURL property specifies the data file as either a file or a URL. The UseHeader property indicates that the first line of the data file contains the column names, which are used for data binding. For example, the first line in Listing A identifies the first column as Artist, the second as Song, and the third as Format.
DataURL and UseHeader are always used, but a number of optional properties can be useful as well. The first is the CharSet property, which identifies the data file’s character set. The FieldDelim property identifies the character that marks the end of a field in the data file. Listing A uses the default character, a comma. The Language property specifies the data file’s language; the default is eng-us. The TextQualifier property identifies the character that surrounds the individual fields. The RowDelim property identifies the character that marks the end of a row. The default RowDelim is the newline character.
Listing B shows a page that uses the Tabular Data Control data source object to display the delimited text file from Listing A. The combined result of these two files appears in Figure A.
Possible applications for the Tabular Data Control data source object include Web-based reporting in situations where the information doesn’t change often and setting defaults on a form. Although the Tabular Data Control data source object isn't as dynamic as I'd like, it does provide some useful functionality when working with somewhat static information.