OLDB to read CSV file but it changes values

harrys

New Member
I have a OLDB connection to read a csv file into a dataset. Now in the CSV I have a column like 3,00 or 15,00 (it's an amount in euro's) but when I call the .Fill method of the OdbcDataAdapter it changes the value into a DateTime. This is the code I use to read the CSV and convert it to a dataset:\[code\]DataSet ds = new DataSet(); try { // Creates and opens an ODBC connection string strConnString = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + filePath.Trim() + ";Extensions=asc,csv,tab,txt;Persist Security Info=False"; string sql_select; OdbcConnection conn; conn = new OdbcConnection(strConnString.Trim()); conn.Open(); //Creates the select command text sql_select = "select * from [" + this.fileName.Trim() + "]"; //Creates the data adapter OdbcDataAdapter obj_oledb_da = new OdbcDataAdapter(sql_select, conn); //Fills dataset with the records from CSV file obj_oledb_da.Fill(ds, "csv"); //closes the connection conn.Close(); } catch (Exception e) //Error { MessageBox.Show(e.Message, "Error - LoadCSV", MessageBoxButtons.OK, MessageBoxIcon.Error); } return ds;\[/code\]A record of the CSV looks like this:\[code\]2005 2 20 7024 0 0 2900 14 19 0,00 3,00 3,00 0,00 0,00 0,00 15,80 18,80 0,00 0,00 90014 99999998 99999998 0 0 23/02/2005 0 stt 7024 15,80 0,00 N 60376940043 fis\[/code\]The record received from the dataset looks like this:\[code\]2005 2 20 7024 0 0 2900 14 19 30-12-1899 0:00:00 30-12-1899 15:26:00 30-12-1899 15:26:00 30-12-1899 0:00:00 30-12-1899 0:00:00 30-12-1899 0:00:00 80,33 95,59 30-12-1899 0:00:00 30-12-1899 0:00:00 92705 99999998 99999998 0 0 23-2-2005 0:00:00 0 stt 7024 80,33 30-12-1899 0:00:00 N fis\[/code\]What am I missing here? Because the record of the DataSet should be exactly the same as the CSV record. I need to convert the CSV to a DataSet because I don't want to add every seperate line into the database, so I insert the DataSet at once into the database (it's an import module)Who can help me with this?Thanks in advance!
 
Top