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
How to have winrunner insert yesterdays date into a field in the application?
What is the XML test cases creation?
What is the usage of Test case Design Techniques,in Integration/System Testing?
wat is the d/b windows 95&98&xp?could anybody give reply ?
The title of the window consists of date and time.What is the regular expression to recognize the window as unique?
How to to get the information from the status bar without doing any activity/click on the hyperlink?
What is the purpose of the temp GUI map file?
When do you feel you need to modify the logical name?
How do you call windows APIs, explain with an example?
what is the use of generate script that is avaliable 3 places(file settings, tools, object identification)
How to find the local host name using winrunner ?
Define parameterizing?
What is tsl? What 4gl is it similar too?
What is the purpose of gui spy?
How do you find out which is the start up file in winrunner?