J
John
I am trying to read in the contents of a Text file to a dataset.
Every time I run the line = "Objconn.open()" it gives me the following
exception "System.data.oledb.oledbexception: 'c:\D.txt' is not a vaild
path yada yada yada" I have changed the location of the file to many
differnt locations as well and replace the file with a different one,
No luck. I was wondering if someone out there could help. Here is my
Code.
Dim sconnectionstring As String
Dim da As OleDb.OleDbDataAdapter
sconnectionstring = "Provider=microsoft.jet.oledb.4.0;Data " &_
"source=c:\D.txt;extended properties=""Text;HDR=Yes;FMT=Delimited """
Dim objconn As New System.Data.OleDb.OleDbConnection(sconnectionstring)
Try
objconn.Open()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Dim sSQL As String
sSQL = "Select * from D.txt"
da = New OleDb.OleDbDataAdapter(sSQL, objconn)
Dim ds As New DataSet("table1")
da.Fill(ds, "table1")
Dim dt As DataTable
dt = ds.Tables("table1")
Every time I run the line = "Objconn.open()" it gives me the following
exception "System.data.oledb.oledbexception: 'c:\D.txt' is not a vaild
path yada yada yada" I have changed the location of the file to many
differnt locations as well and replace the file with a different one,
No luck. I was wondering if someone out there could help. Here is my
Code.
Dim sconnectionstring As String
Dim da As OleDb.OleDbDataAdapter
sconnectionstring = "Provider=microsoft.jet.oledb.4.0;Data " &_
"source=c:\D.txt;extended properties=""Text;HDR=Yes;FMT=Delimited """
Dim objconn As New System.Data.OleDb.OleDbConnection(sconnectionstring)
Try
objconn.Open()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Dim sSQL As String
sSQL = "Select * from D.txt"
da = New OleDb.OleDbDataAdapter(sSQL, objconn)
Dim ds As New DataSet("table1")
da.Fill(ds, "table1")
Dim dt As DataTable
dt = ds.Tables("table1")