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 to integrate automated scripts from testdirector to winrunner scripts?

0 Answers  


can any body tell me in detail about ERP domine?

0 Answers  


hi all this is srivalli i had completed my b.e in 2005, i want to learn testing.so anybody plz hep mi wat'll b thr in testing n which is da best institute n how r da job opprtunities right now coz ppl r telling mi thr is sum down trend in sw now, so how much it is appropriate 2 take da course now. thankz in aadv

4 Answers  


what is the main diff of Qtp9.2 and 9.5 plz tell me

5 Answers   HCL, IBM,


Have you created test scripts and what is contained in the test scripts?

1 Answers  






write a function for addition of two numbers

1 Answers   Polaris,


What is the Extension File name of WinRunner?

11 Answers   Satyam,


Data is there in two excel sheets .. how ur going to retrive the data in winrunner thru script.. write down the script?

3 Answers   AZTEC,


hi i am unable to do select the flight in the flight table like list_select_item ("Flight",v_Select_Flight); v_Select_Flight=19072 LON 08:00 AM LAX 10:00 AM AF $161.90 why it is happining pls clarify me doubt

1 Answers  


can we run compiled-mod function in a compiled module function?if yes then fwd sample script?

1 Answers  


can we write exception handlers (object,tsl,pop-up) programatically then how should we insert this in the script?

2 Answers  


How do you select multiple objects during merging the files?

0 Answers  


Categories