查询文本文件

时间:2012-05-10 08:41:42

标签: vb.net text oledb

嘿,所有有任何方法可以使用OleDB或其他东西查询文本文件。只需要能够像下面这样查询它:

    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()

任何帮助都会很棒!

1 个答案:

答案 0 :(得分:1)

试试这样。

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

http://www.connectionstrings.com/textfile