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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain difference between winrunner and test director?

644


What are the three modes of running the scripts?

574


How to check the background colour of the screen in WR?

1510


Explain data parameterization in winrunner?

601


What is the use of gui map and what happens when gui map file get loaded?

701






Are there any suitable free tools to conduct performance test on a php web application?Manual or automation which is preferable for such kind of application? please answer ASAP

1809


I want to do smoke test in my application but i have learnt the application before recording but im getting an error class name not found while running the script.I want to check each links and each text in my application. Can anybody answer my quesion plz.If it is possible i want test script for Yahoo login form with "New User" Login.

1647


What is a checkpoint and what are different types of checkpoints?

714


How to do text matching?

619


Difference between winrunner and test director?

672


How to have winrunner insert yesterdays date into a field in the application?

603


you hae a inbox and got a mail how can you know it is there or not write script.

1567


Hi iam a begginer or rather new stsrter to QTP and strugling to start as i have to start writing the automated scripts for the existing manual testing could some one send me some tips ans tricks for a jump start. Any help is greatly appreciated

1830


What is the purpose of set_window command?

721


What is the purpose of a gui spy?

712