opening and reading .csv files
Hi,
I need help opening and reading a csv file. The csv files im dealing with are in an excel format...in fact they info is in excel but the extension is .csv. The first line in this csv..excell file is the heading which says Pressure then line 2 through line 5 there are pressure numbers. I wish to read this data into text boxes. Ive tried putting this data into a data column using odbc but im having trouble with it. Here is the code:
strConnectString = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=Gauge.CSV"
dbConn = New Odbc.OdbcConnection(strConnectString)
strSQL = "SELECT [Pressure] AS Pressure FROM Gauge.CSV"
da = New System.Data.Odbc.OdbcDataAdapter(strSQL, dbConn)
dt = New DataTable
dc = New System.Data.DataColumn
dc.ColumnName = "Pressure"
dc.DataType = System.Type.GetType("System.String")
dt.Columns.Add(dc)
da.Fill(dt)
dbConn.Close()
While (RowPosition <> (dt.Rows.Count)) 'while current row position <> total row count
Press = (dt.Rows(RowPosition)("Pressure")).ToString() 'Gets Pressure
End While
thank you