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

hi, this is balu. I looking for testing job. I want qtp software . any body have . pls send mail to me dont forget. send a mail to me kool.balu@gmai.com

1 Answers  


how v should get data from third excel sheet?

1 Answers  


What is the difference bitween Client/Server Applications and Web Applicaions?

5 Answers   iSoft, Patni,


What is the procedure for Using Batch tests?And in real time how will use you use batch Tests?Explain with Clear Example?

1 Answers   Logica CMG,


What are different types of checkpoints?

0 Answers  


What are the features r there in winrunner 7.6 over winrunner 7.01..B'cos Iam using Winrunner 7.01

2 Answers  


plese tell me about vss?

3 Answers  


what is mean by v module . pls give answer with example

2 Answers  


What is debug mode in Winrunner?

0 Answers  


what is automation life cycle?

2 Answers   EDS,


what is contained in the GUI check list?

1 Answers   FCG,


what is Retesting and what is the difference between Retesting and Regression testing?

7 Answers   Accenture, Infeneon Technologies,


Categories