[ Team LiB ] Recipe Connecting to a Text File Problem You want to use to access data stored in a text file. Solution Use the OLE DB Jet provider to access data in a text file. The sample code creates an OleDbDataAdapter that uses the Jet OLE DB | Team LiB Recipe Connecting to a Text File Problem You want to use to access data stored in a text file. Solution Use the OLE DB Jet provider to access data in a text file. The sample code creates an OleDbDataAdapter that uses the Jet OLE DB provider to load the contents of the text file shown in Example 1-13 into a DataTable and displays the contents in a data grid on the form. Example 1-13. File CategoryID CategoryName Description 1 Beverages Soft drinks coffees teas beers and ales 2 Condiments Sweet and savory sauces relishes spreads and seasonings 3 Confections Desserts candies and sweet breads 4 Dairy Products Cheeses 5 Grains Cereals Breads crackers pasta and cereal 6 Meat Poultry Prepared meats 7 Produce Dried fruit and bean curd 8 Seafood Seaweed and fish The C code is shown in Example 1-14. Example 1-14. File Namespaces variables and constants using System using using using using . . . Create the data adapter to retrieve all rows from text file. OleDbDataAdapter da new OleDbDataAdapter SELECT FROM TextFile_0119_ConnectString Create and fill the table. DataTable dt new DataTable Categories dt Bind the default view of the table to the grid. Discussion The Jet OLE DB provider can read records from and insert records into a text file data source. The Jet database engine can access other database file formats through Indexed Sequential Access Method ISAM drivers specified in the Extended Properties attribute of the connection. Text files are supported with the text source database type as shown in the following example Provider Data Source c MyTextFileDirectory Extended Properties text HDR yes FMT Delimited The Extended Properties attribute can in addition to the ISAM version property specify whether .