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

How do you find an object in an gui map.

772


when start testing

2184


How do you modify the logical name or the physical description of the objects in gui map?

641


How do you suppress a regular expression?

1483


What are the synchronization points?

642






soft key for virtual object wizard ?

1892


Which function to use to compare the application date with system date?

1459


How do you handle pop-up exceptions?

592


Dear all i am new to testing my company using vb.net and we are developing web based application. How i can test those application with winrunner if any one have some good tutorial or link kindly provide thanks u.

1545


What happens when the gui map file get loaded?

656


Where did you learn winrunner and testdirector?

679


What are the two modes of recording?

585


What do you verify with the gui checkpoint for single property and what command it generates, explain syntax?

837


What is test parameter

1582


What is boundary test?

636