Compare values of DataList with Oracle Select

Ask general questions here.
Enjoy
Posts: 9
Joined: Tue Apr 13, 2010 10:05 am

Compare values of DataList with Oracle Select

Post by Enjoy » Thu Apr 22, 2010 3:05 pm

Hi!!

Scripts:
i´m trying to compare values of this select:
cmd.CommandText = "SELECT distinct var_xx FROM xxxWHERE upper(var_name) = 'REPORTED OWNER' AND (facility is null or facility in ('201')) ORDER BY 1 ASC";

With the script below i can read the elements of the select which are olnly 1 column with 7 or 8 elements.
I need to compare those elements with the element of a container listBox(/form[@controlname='SUT']/container/container[@controlname='_multiSelection']/container/tabpagelist/tabpage[@controlname='tabPageOwner']/container/container/list/list[@accessiblerole='List'] .
I'm using the script below to read the values of the select but i need some code to make that comparison.
Can you help me?

using(OracleConnection conn = new OracleConnection(connectionStr))
{

conn.Open();
OracleCommand cmd = conn.CreateCommand();
//OracleDataReader reader = cmd.ExecuteReader();
OracleTransaction transaction;
transaction = conn.BeginTransaction();
cmd.Connection = conn;
cmd.Transaction = transaction;
OracleDataReader reader = null;


try{
cmd.CommandText = "SELECT distinct var_value FROM cexx_var WHERE upper(var_name) = 'REPORTED OWNER' AND (facility is null or facility in ('1002)) ORDER BY 1 ASC";
reader = cmd.ExecuteReader();

if(reader.HasRows)
{
while(reader.Read())
{
Report.Info(reader.GetString(0));

//Response.Write(reader["0"].ToString());
}
}
else
{
Report.Failure("Important","Select didn't return values");
}
Last edited by Enjoy on Fri Apr 23, 2010 10:56 am, edited 2 times in total.

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

Re: Compare values of DataList with Oracle Select

Post by Support Team » Thu Apr 22, 2010 3:58 pm

Hi!

You get a list of items form your Select Command. Use Ranorex.List to get all items from the listbox and compare those to your Select list.
Here is a little code example to get Item of Listbox.
List myList = "yourPathToList";    
foreach(ListItem item in myList.Items)
{
    Console.WriteLine(item.Text);                    
}
Also take a look to the API
http://www.ranorex.com/Documentation/Ra ... x_List.htm

Regards,
Peter
Ranorex Support Team
.
Image