Brian Mulder
asked on
How to circumvent the message "could not find installable ISAM"
Hello All,
Been looking at this since friday and accepted it for a fact but would like to solve my problem.
I have a small project that reads a csv file like
---------
field1;field2;field3;field 4;
myname here;anothername ;and anotherone;the last one;
myname here;anothername ;and anotherone;the last one;
myname here;anothername ;and anotherone;the last one;
myname here;anothername ;and anotherone;the last one;
---------
and some code that reads the CSV into a Dataset like
---------
Private Function GetCSVFile(ByVal pathName As String, ByVal fileName As String) As DataSet
Dim CSVConnection As OleDb.OleDbConnection = New OleDb.OleDbConnection("Pro vider=Micr osoft.Jet. OLEDB.4.0; Data Source=" & pathName & ";Extended Properties=Text;")
Dim CSVCommand As OleDb.OleDbCommand = New OleDb.OleDbCommand("SELECT * FROM " & fileName, CSVConnection)
Dim CSVAdapter As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter(CSV Command)
CSVConnection.Open()
Dim CSVDataSet As DataSet = New DataSet()
CSVAdapter.Fill(CSVDataSet )
CSVConnection.Close()
Return CSVDataSet
End Function
---------
That works except when you need to add some more extended properties like HDR=YES; etc.... I know i'm missing something but what?
Whatever i try, like quotes or double quotes or same line or anything else it does not work, so i leave this question open until someone posts a working piece of code in VB or C# doesn't matter as long as it works for loading a textfile into a dataset and being able to add more extended properties then Extended Properties=Text;
thanks a bunch
Brian
Been looking at this since friday and accepted it for a fact but would like to solve my problem.
I have a small project that reads a csv file like
---------
field1;field2;field3;field
myname here;anothername ;and anotherone;the last one;
myname here;anothername ;and anotherone;the last one;
myname here;anothername ;and anotherone;the last one;
myname here;anothername ;and anotherone;the last one;
---------
and some code that reads the CSV into a Dataset like
---------
Private Function GetCSVFile(ByVal pathName As String, ByVal fileName As String) As DataSet
Dim CSVConnection As OleDb.OleDbConnection = New OleDb.OleDbConnection("Pro
Dim CSVCommand As OleDb.OleDbCommand = New OleDb.OleDbCommand("SELECT
Dim CSVAdapter As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter(CSV
CSVConnection.Open()
Dim CSVDataSet As DataSet = New DataSet()
CSVAdapter.Fill(CSVDataSet
CSVConnection.Close()
Return CSVDataSet
End Function
---------
That works except when you need to add some more extended properties like HDR=YES; etc.... I know i'm missing something but what?
Whatever i try, like quotes or double quotes or same line or anything else it does not work, so i leave this question open until someone posts a working piece of code in VB or C# doesn't matter as long as it works for loading a textfile into a dataset and being able to add more extended properties then Extended Properties=Text;
thanks a bunch
Brian
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
found the correct string finally here
source: http://www.thescripts.com/forum/thread387079.html
so my string becomes
Dim CSVConnection As OleDb.OleDbConnection = New OleDb.OleDbConnection("Pro vider=Micr osoft.Jet. OLEDB.4.0; Data Source=" & pathName & ";Extended Properties=""Text;HDR=Yes; FMT=Delimi ted""")
which works
thanks for your interest
source: http://www.thescripts.com/forum/thread387079.html
so my string becomes
Dim CSVConnection As OleDb.OleDbConnection = New OleDb.OleDbConnection("Pro
which works
thanks for your interest
ASKER
i need to be at home to put in the disc doing the install / repair of office