Accessing Text File from ADO.NET Database in VB.NET

In this article I will explain about Accessing Text File Databases in ADO.NET.
  • 1060
To test database connectivity, you can export the Employees table of the Northwind database using the File > Export option of Access 2000. In this section, I'll export a table to a text file, and I'll show you how to use it using the ODBC data adapter.
Exporting an Access Table to a Text File
You can export an Access database table to a text file using the Export option. As you can see from figure 11-22, I selected the Employees table and chose file > Export.
Note: You can also select the Export option by right-clicking on the table.
Figure 11-22: Exporting the employees table of Northwind.mdb
The next dialog box lets you pick a path and filename you want to export. There are many export options are available. As you can see from figure 11-23, I selected the Text files option, left the exported filename as Employees, and saved the file to the C:\root directory. 
Figure 11-23: Selecting a path of exporting file
Now, the Export Text Wizard lets you define the format of the text file. A dialog box lets you select either delimited or fixed width (see Figure 11-24).
Figure 11-24: Export Text Wizard options
You can also select the Advanced option to set more options (see Figure 11-25).

Figure 11-25: The Advanced option of Export Text Wizard
The next screen lets you pick the delimiter including comma, tab, semicolon, space, and others. I left the Comma option checked (see Figure 11-26).
Figure 11-26: Delimiter options of Export Text Wizard
I also checked the Include Field Names on first Row check box. This option adds the first row of the text file as field names. 
The last page asks you the filename (see Figure 11-27).
Figure 11-27: Filename page of the Export Text Wizard
Now click the finish button. When the wizard is done exporting, you'll see a message saying the export is finished. Click OK and close Access. 
Now view C:\Employees.txt (see figure 11-28).
Figure 11-28: Exported Employees.txt file from Northwind.mdb
Hope this article would have helped you in understandingAccessing Text File Databases in ADO.NET. See my other articles on the website on ADO.NET.


More Articles

© 2013 dotNetheaven. All rights reserved.