CSVConnector Issue

Ask general questions here.
mzammari10
Posts: 2
Joined: Wed Oct 19, 2011 3:42 pm

CSVConnector Issue

Post by mzammari10 » Wed Oct 19, 2011 3:53 pm

I am using Ranorex version 2.3.8.10854. I followed the example in User Guide for Data-Test driven to read data from a csv file. I got "The type or namespace name 'CSVConnector' could not be found..." I search in your forum and found out that I had to use System.Data which I did, but I still cannot get it to read from file.

I created the csv file on my desktop and used the following code to refer to it:
CSVConnector csvConnector = new CSVConnector(@"C:\Users\"MyUserName"\Desktop\LookupData.csv")

What seems to be the problem?

here is my code from Program.cs
using System;
using System.Data;
using System.Threading;
using System.Drawing;
using System.Text.RegularExpressions;
using System.Windows.Forms;

using Ranorex;
using Ranorex.Core;

namespace Test1
{
class Program
{
[STAThread]
public static int Main(string[] args)
{
Keyboard.AbortKey = System.Windows.Forms.Keys.Pause;
int error = 0;

string logFileName = "Test.rxlog";

Report.Setup(ReportLevel.Info, logFileName, true);

try
{
// Create a new CSVConnector object
CSVConnector csvConnector = new CSVConnector(@"C:\Users\mzammari\Desktop\LookupData.csv");

// Read every row from connector and send to AddVIPApplication.
foreach(DataRow row in csvConnector.Rows)
{
Recording1.AccountID= row["AccountID"].ToString();
Recording1.Start();
}
}
catch (ImageNotFoundException e)
{
Report.Error(e.ToString());
Report.LogData(ReportLevel.Error, "Image not found", e.Feature);
Report.LogData(ReportLevel.Error, "Searched image", e.Image);
error = -1;
}
catch (RanorexException e)
{
Report.Error(e.ToString());
Report.Screenshot();
error = -1;
}
catch (ThreadAbortException)
{
Report.Warn("AbortKey has been pressed");
Thread.ResetAbort();
error = -1;
}
catch (Exception e)
{
Report.Error("Unexpected exception occured: " + e.ToString());
error = -1;
}

Report.End();
return error;
}
}
}

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: CSVConnector Issue

Post by Support Team » Wed Oct 19, 2011 4:44 pm

I just did a quick search on the Ranorex Forum for "CSVConnector" and the first hit should help you fixing this problem:
http://www.ranorex.com/forum/csvconnect ... -t960.html

Regards,
Alex
Ranorex Team

mzammari10
Posts: 2
Joined: Wed Oct 19, 2011 3:42 pm

Re: CSVConnector Issue

Post by mzammari10 » Wed Oct 19, 2011 6:03 pm

Thank you for the reply.

How can I include the CSVConnector.cs in my project?

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: CSVConnector Issue

Post by Support Team » Thu Oct 20, 2011 12:37 pm

Hi,
mzammari10 wrote:How can I include the CSVConnector.cs in my project?
Just drag and drop the file to the project browser in Ranorex Studio or you the context menu to add an existing file.
I also would suggest you to read the User Guide if you are new at Ranorex
http://www.ranorex.com/support/user-guide-20.html

Regards,
Peter
Ranorex Team