StealthRT
StealthRT

Reputation: 10542

Query a text file

Hey all is there any way to query a text file using OleDB or something else. Just need to be able to query it like below:

    Dim connectionString As String
    connectionString = "Provider=?????????????????;Data Source=C:\Data\theFile.txt"
    connection = New System.Data.OleDb.OleDbConnection(connectionString)
    connection.Open()

    Dim sqlString As String
    sqlString = "SELECT * FROM Categories"
    Dim command As New System.Data.OleDb.OleDbCommand(sqlString, connection)
    'Retrieve data 
    reader = command.ExecuteReader()

Any help would be great!

Upvotes: 0

Views: 1481

Answers (1)

hkutluay
hkutluay

Reputation: 6944

Try like this.

con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|;Extended properties='text;HRD=yes;FMT=Delimited'")

http://www.connectionstrings.com/textfile

Upvotes: 1

Related Questions