How to Get data from database(table) to an excel sheet

Answers were Sorted based on User's Feedback



How to Get data from database(table) to an excel sheet..

Answer / naga chiranjeevi kota

Session="mysession";


connstring="DSN=DQMCHIRU;UID=dqm5map;pwd=dqm5map;server=Orcl";
rc=db_connect(Session,connstring);

x="select PART_NUM,PART_ORG ,RDX_ID,DESCRIPTION from
reference_data_part where part_num like '%31' order by
PART_NUM";
printf(x);

# Opening the excel sheet
dqmdata = "C:\ExecuteSampleData.xls";
rc = ddt_open(dqmdata, DDT_MODE_READWRITE);
if (rc!= E_OK && rc != E_FILE_OPEN)
pause("Cannot open table.");

dc=db_execute_query(Session,x,rows);

#ddt_get_row_count(dqmdata,rows);
for(i=0;i<rows;i++)
{
db_get_row(Session,i,rowcon);
#ddt_set_row(dqmdata,i);
split(rowcon,rdp,"\t");
for(j=0;j<4;j++)
{
printf("R"&i+1&", C"&j+1&": "&rdp[j+1]);
ddt_set_val_by_row(dqmdata,i+1,"C"&(j+1),rdp[j+1]);

}
}

db_disconnect(Session);
ddt_save(dqmdata);
ddt_close(dqmdata);


answer by: Naga Chiranjeevi Kota(iGATE)

Is This Answer Correct ?    0 Yes 0 No

How to Get data from database(table) to an excel sheet..

Answer / softwaretester4u

hi this is good answer.But i have one question is it
possible to call differect sheets in same excel
like sheet1 have one data,sheet2 have some data in same
excel .is it possible to call ? pls tell me

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More WinRunner Interview Questions

How does WinRunner recognize objects on the application?

3 Answers  


The extension of the Script file is .mts ok Whis is stand for mts?

4 Answers  


If winrunner doesn't understand the Text in the Application what you do?

1 Answers   FCG,


What is the TSL function in WinRunner to connect to test director?

1 Answers   Infosys, Kanbay, Scope International,


Difference between winrunner and test director?

0 Answers  






how can we upload manul test caseses in to test director

1 Answers  


how u can do parameterization in winrunner? tell me the sample code.

2 Answers   Mastek, MBT,


what is batch mode, how can u run ur tests in batch mode?

3 Answers   MBT,


What Framework is suitable to validate the Login screen.

0 Answers  


How do you find an object in an gui map.

0 Answers  


Whole application is taking as single html frame while recording and learning but i want to learn each textbox,text,links whatever the page have.If we click any link in one page that will show another page so i want to learn that pages objects also.I want navigation steps or guidence plz

1 Answers  


which checkpoint is used to analyze the appearance of AUT

1 Answers  


Categories