Sorry about the blank message earlier. The best way to access text files
in .NET is to use the System.IO classes not ODBC. The following piece of
code is a quick example
Imports System.IO
Dim theFile As File
Dim myReader As StreamReader
Dim filePath As String
Dim tempHolder As String
'Define the path and file so you don't have to retype each time
filePath = "c:\TextFile.txt"
'First check to make sure that the file exists
If (theFile.Exists(filePath)) Then
Try
'Create new instance of stream reader and pass it the
file to open
myReader = New StreamReader(filePath)
'Read all of the contents of the file
tempHolder = myReader.ReadToEnd
'Close the stream reader object
myReader.Close()
'Display the contents
MessageBox.Show(tempHolder)
'Catch any IOExceptions
Catch Except As IOException
Dim errLog As EventLog
'Create new intance of the event log an define the source
and what log to write to
errLog = New EventLog("Application", ".", Except.Source)
'Write the error to the event log
errLog.WriteEntry(Except.Message, EventLogEntryType.Error)
End Try
End If