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;
}
}
}
CSVConnector Issue
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: CSVConnector Issue
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
http://www.ranorex.com/forum/csvconnect ... -t960.html
Regards,
Alex
Ranorex Team
-
- Posts: 2
- Joined: Wed Oct 19, 2011 3:42 pm
Re: CSVConnector Issue
Thank you for the reply.
How can I include the CSVConnector.cs in my project?
How can I include the CSVConnector.cs in my project?
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: CSVConnector Issue
Hi,
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
Just drag and drop the file to the project browser in Ranorex Studio or you the context menu to add an existing file.mzammari10 wrote:How can I include the CSVConnector.cs in my project?
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