F
Frank
I cannot get the followin to code to work:
Const str_datafile As String = "F:\T"
Private connKunde1 As OleDb.OleDbConnection
Private dadapKunde1 As OleDb.OleDbDataAdapter
Private dacmdKunde1 As OleDb.OleDbCommand
Private datsetKunde1 As DataSet
Private Sub form_datatest_Load(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
Dim str_sql As String = "SELECT * FROM
KunddatTest.txt"
connKunde1 = New OleDb.OleDbConnection
("Provider=Microsoft.Jet.OLEDB.4.0; " _
& "Data Source=" & str_datafile & ";" _
& "Extended
Properties=""Text;HDR=YES;FMT=Delimited""")
connKunde1.Open()
dadapKunde1 = New OleDb.OleDbDataAdapter(str_sql,
connKunde1)
dadapKunde1.TableMappings.Add
("Table", "KunddatTest.txt")
datsetKunde1 = New DataSet
' line with error
dadapKunde1.Fill(datsetKunde1, "KunddatTest.txt")
Me.datagrid_kunde_1.DataSource = datsetKunde1.Tables
("KunddatTest.txt")
End Sub
The error is: "An unhandled exception of
type 'System.Data.OleDb.OleDbException' occurred in
system.data.dll"
In the directory F:\T I have a Schema.ini file (don't
know if it is even needed):
[KunddatTest.txt]
ColNameHeader=True
Format=CSVDelimited
MaxScanRows=100
CharacterSet=ANSI
Any suggestions as to what the problem might be, will
much appreciated.
With kind regards,
Frank
Const str_datafile As String = "F:\T"
Private connKunde1 As OleDb.OleDbConnection
Private dadapKunde1 As OleDb.OleDbDataAdapter
Private dacmdKunde1 As OleDb.OleDbCommand
Private datsetKunde1 As DataSet
Private Sub form_datatest_Load(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
Dim str_sql As String = "SELECT * FROM
KunddatTest.txt"
connKunde1 = New OleDb.OleDbConnection
("Provider=Microsoft.Jet.OLEDB.4.0; " _
& "Data Source=" & str_datafile & ";" _
& "Extended
Properties=""Text;HDR=YES;FMT=Delimited""")
connKunde1.Open()
dadapKunde1 = New OleDb.OleDbDataAdapter(str_sql,
connKunde1)
dadapKunde1.TableMappings.Add
("Table", "KunddatTest.txt")
datsetKunde1 = New DataSet
' line with error
dadapKunde1.Fill(datsetKunde1, "KunddatTest.txt")
Me.datagrid_kunde_1.DataSource = datsetKunde1.Tables
("KunddatTest.txt")
End Sub
The error is: "An unhandled exception of
type 'System.Data.OleDb.OleDbException' occurred in
system.data.dll"
In the directory F:\T I have a Schema.ini file (don't
know if it is even needed):
[KunddatTest.txt]
ColNameHeader=True
Format=CSVDelimited
MaxScanRows=100
CharacterSet=ANSI
Any suggestions as to what the problem might be, will
much appreciated.
With kind regards,
Frank