I've downloaded WinSamples and experienced some of the samples perfectly well except for 'CSVDataBinding' !!
It generates during running an error : 'IndexOutofRangeException' when binding .... (it seems to me that actually the reader is not correctlty working since the number of data fields detected is only 1 while it should be 5).
It tried also with my own code derived from the sample in Visual Basic and I get the same error...:-(((
here is the code :
Imports Chrt = System.Windows.Forms.DataVisualization.Charting<br/>
Imports System.Data ' Necessaire pour l'import de données CSV<br/>
Imports System.Data.OleDb ' Necessaire pour l'import de données CSV<br/>
<br/>
' Full path to the data source file
Dim fileCSV As String = "DataFile.csv"
' Create a connection string.
Dim ConStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\temp\;Extended Properties=""Text;HDR=No;FMT=Delimited"""
Dim myConnection As New OleDbConnection(ConStr)
' Create a database command on the connection using query
Dim mySelectQuery As String = "Select * From " + fileCSV<br/>
Dim myCommand As New OleDbCommand(mySelectQuery, myConnection)
' Open the connection and create the reader
myCommand.Connection.Open()
Dim myReader As OleDbDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
' databind the reader to the chart using the DataBindXY method
ChartJP.Series("Serie1JP").Points.DataBindXY(myReader, "0", myReader, "2")
' Close connection and data reader
myReader.Close()
myConnection.Close()
I scanned the forum and found some tips like putting the csv file name within brackets but it does not change anything.... :-(((
Help would be greatly appreciated .... thanks in advance
Nota : I'm working in a "French" windows environment (XP SP2)