Error in Data fetch from csv file

Ask general questions here.
smigup
Posts: 13
Joined: Mon Nov 30, 2009 9:49 am

Error in Data fetch from csv file

Post by smigup » Mon Nov 30, 2009 1:04 pm

Hi,

Some issue with teh below code snippet.. I believe "DataRow" is not a defined object in the Library, can you suggest which object can I use to retrieve rows from my csv file ?

Thanks,
Smita

Code: Select all

CSVConnector csvConnector = new CSVConnector(@"..\..\CV.csv"); 
					
foreach( DataRow row in csvConnector.Rows)

Error Message with above
======================
The type or namespace name 'DataRow' could not be found (are you missing a using directive or an assembly reference?) (CS0246) - C:\Automation\..\Program.cs:43,16

smigup
Posts: 13
Joined: Mon Nov 30, 2009 9:49 am

Re: Error in Data fetch from csv file

Post by smigup » Mon Nov 30, 2009 1:14 pm

Once I qualify with System.Data, it works.
Thanks, Smita

smigup
Posts: 13
Joined: Mon Nov 30, 2009 9:49 am

Build Error ..

Post by smigup » Wed Dec 02, 2009 7:46 am

Hi,

Getting following error while compiling. Can someone guide me where to look for this duplicate ?

Thanks
Smita

The item "Part.UserCode.cs" was specified more than once in the "Sources" parameter. Duplicate items are not supported by the "Sources" parameter. (MSB3105)

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Error in Data fetch from csv file

Post by Support Team » Wed Dec 02, 2009 5:20 pm

It seems you have two files called "Part.UserCode.cs" in your project. You have to rename one of them in order to make the project build again.

Did you accidently move/copy the "Part.UserCode.cs" file from a recording named "Part" to somewhere else in the project?

Regards,
Alex
Ranorex Support Team
.
Image

SanMan
Posts: 150
Joined: Tue Apr 13, 2010 9:59 am

Re: Error in Data fetch from csv file

Post by SanMan » Wed Apr 14, 2010 10:02 am

I have this same problem when trying to compile modified Data Driven Test:

The type or namespace name 'DataRow' could not be found (are you missing a using directive or an assembly reference?) (CS0246)

What could be wrong? I am newbe and practicing the features...


Solved: I was missing:
using System.Data;

Don't know why?

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Error in Data fetch from csv file

Post by Support Team » Wed Apr 14, 2010 12:26 pm

The .NET Framework is structured by namespaces. DataRow is a class in the .NET Framework and resides in the System.Data namespace. Therefore you have to either always qualify the class name with the full namespace (i.e. System.Data.DataRow) or add a "using System.Data;" statement at the beginning of the code file.

For further information see the corresponding MSDN documentation:
http://msdn.microsoft.com/library/z2kcy19k.aspx

Regards,
Alex
Ranorex Support Team
.
Image