This is a migrated thread and some comments may be shown as answers.

Csv separator

2 Answers 132 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Igor
Top achievements
Rank 1
Igor asked on 15 Dec 2010, 03:57 PM
Hi. I have next code
var table=Csv.GetDataSet("C:\\Documents and Settings\\Administrator\\Desktop\\SFT\\Data\\Units.csv").Tables[0];
var tableRow=table.Rows[0][1];
table.Rows[0][1]= scuId;
Csv.SaveTable(table,"C:\\Documents and Settings\\Administrator\\Desktop\\SFT\\Data\\Units.csv");

I launch test and it fails because of values is separated by comma.

Failure Information:
~~~~~~~~~~~~~~~
Exception thrown executing coded step: '[UnitGroupCreation_CodedStep2] : Write group name in file'.
InnerException:
System.IndexOutOfRangeException: Cannot find column 1.
   at System.Data.DataColumnCollection.get_Item(Int32 index)
   at System.Data.DataRow.set_Item(Int32 columnIndex, Object value)
   at SFT.UnitGroupCreation.UnitGroupCreation_CodedStep2() in c:\Documents and Settings\Administrator\Desktop\SFT\UnitGroupCreation.aii.cs:line 75

If I modify Units.csv manually and change separator from ',' to ';' the test will be passed successfully.

The problem is not resolved if I change list separator in the regional configurations in my system. Could anybody help?

2 Answers, 1 is accepted

Sort by
0
Igor
Top achievements
Rank 1
answered on 16 Dec 2010, 11:13 AM
Could anybody help?
0
Cody
Telerik team
answered on 21 Dec 2010, 12:09 AM
Hi Igor,

I tried to reproduce the problem but so far I have not been able to. I did find that the first row of data in the CSV file is used the column names and the second row of data becomes the first row of data in the generated Table.

Can you please include your Csv class code along with your CSV file you're trying to use.

Greetings,
Cody
the Telerik team
Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment
Tags
General Discussions
Asked by
Igor
Top achievements
Rank 1
Answers by
Igor
Top achievements
Rank 1
Cody
Telerik team
Share this question
or