Read data from database

Ask general questions here.
SanMan
Posts: 210
Joined: Tue Apr 13, 2010 9:59 am

Read data from database

Post by SanMan » Fri Apr 21, 2017 8:07 am

Very basic question. :oops:

I have a excel dataconnection created.

1 aaa
2 bbb
3 ccc

How do I read with C# code e.g. row 3 column 2 data [ccc] ?

Or do I need to create:

ExcelDataConnector and use that to read data?

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

Re: Read data from database

Post by SanMan » Fri Apr 21, 2017 8:55 am

I think I found the solution from here:

http://www.ranorex.com/forum/how-to-acc ... t5553.html

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

Re: Read data from database

Post by SanMan » Wed May 10, 2017 10:48 am

And one more question:

Now that I can read the data from excel file (how-to-access-multiple-excel-files-from-usercode-module-t5553.html)...

how can I input data to excel?

Can I use somehow excelConnector.StoreData() method and how to do it?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Read data from database

Post by odklizec » Wed May 10, 2017 11:05 am

Hi,

I'm afraid, there is currently no way to add data to excel via Ranorex data connector. You will have to implement your own Excel writing, based of 3rd party excel components of MS methods.

In Ranorex, it's possible to save data with CSV data connector. This is why it's much better to use CSV, instead of excel. Additionally, Ranorex is also much faster when working with CSV files, it's possible to directly edit CSV files in data connector dialog and it's possible to compare CSV files via any text comparison tool (or in source control).
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

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

Re: Read data from database

Post by SanMan » Wed May 10, 2017 12:17 pm

Hi,

thank you for your answer. I can well manage with CSV.

What I need is to check while running cases how many options some list have (A,B,C...) and then run the cases with that data with other list.

e.g.

A: 1-2-3

B: 1-2-3

C: 1-2-3
...

Is it possible to save this data (A,B,C..) and use it as data source / bound variable ?

Sorry again not been able to explain my problem clearly (as a non-programmer :( )

McTurtle
Posts: 297
Joined: Thu Feb 23, 2017 10:37 am
Location: Benedikt, Slovenia

Re: Read data from database

Post by McTurtle » Mon May 15, 2017 7:24 am

Hello SanMan,

I am not sure that writing into a CSV file during runtime is actually necessary in this case. Please describe your use case in more detail and probably someone will come up with a simpler solution.

Regards,
McTurtle

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

Re: Read data from database

Post by SanMan » Mon May 15, 2017 10:39 am

Hi McTurtle,

There must be something wrong with the link: "The page you requested cannot be found.
The page you are looking for might have been removed, had its name changed, or is temporarily unavailable"

But no problem; I did solve the problem without writing during runtime :)

BR,
SanMan

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Read data from database

Post by odklizec » Mon May 15, 2017 10:58 am

Hi,

There is missing "l" at the end of link ;) Try this one:
csv-file-reading-writing-t3520.html
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration