Text data provider

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In ODBC and ADO there was the capability to open delimited (tab etc.) text files. Is there the same capability with ADO.NET and can someone point me to some relevant documentation/examples?
 
¤ In ODBC and ADO there was the capability to open delimited (tab etc.) text files. Is there the same capability with ADO.NET and can someone point me to some relevant documentation/examples?

Below is an ADO.NET example using the Jet OLEDB provider:

Dim ConnectionString As String
Dim SQLString As String

ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=e:\My Documents\TextFiles;" & _
"Extended Properties=""Text;HDR=NO;"""

SQLString = "Select * from TextFile.csv"

Dim ConnectionText As New OleDb.OleDbConnection

ConnectionText.ConnectionString = ConnectionString

ConnectionText.Open()

Dim AdapterText As New OleDb.OleDbDataAdapter(SQLString, ConnectionText)

Dim DataSetText As New DataSet("TextFiles")
AdapterText.Fill(DataSetText, "TextFile")

DataGrid1.SetDataBinding(DataSetText, "TextFile")

ConnectionText.Close()


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Back
Top