How to Import(insert) data from an excel sheet to
Database(table).

Answer Posted / naga chiranjeevi kota

Session="mysession";

connstring="DSN=DQMCHIRU;UID=scott;pwd=tiger;server=Orcl";
rc=db_connect(Session,connstring);
dqmdata = "C:\TestSheet.xls";
rc = ddt_open(dqmdata, DDT_MODE_READWRITE);

ddt_get_row_count(dqmdata,noOfRows);
printf(noOfRows);
for(i=0;i<noOfRows;i++)
#for(i=0;i<1;i++)
{
a = ddt_val_by_row(dqmdata,i+1,"a");
b = ddt_val_by_row(dqmdata,i+1,"b");
c = ddt_val_by_row(dqmdata,i+1,"c");
d = ddt_val_by_row(dqmdata,i+1,"d");
x="insert into dqmchiru values('"&a &"','"&b &"','"&c
&"','"&d&"')";
printf("R"&i+1&": "&x);
dc=db_execute_query(Session,x,rows);

}
dc=db_execute_query(Session,"Commit",rows);
db_disconnect(Session);
ddt_save(dqmdata);
ddt_close(dqmdata);


answer by: Naga Chiranjeevi Kota(iGATE)

Is This Answer Correct ?    1 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What information is contained in the checklist file?

597


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

711


How do you handle dynamically changing area of the window in the bitmap checkpoints?

614


What is debug mode in Winrunner?

1711


what are the differences you see in e-commerce and banking domain in testing point of view Thanks in Advance

1037






by useing qtp where the maximum people feeling difficult

1399


Difference between winrunner and test director?

670


Hiiiiiiiii This is lavanya.....At present i m working as a MATLAB developer at CMC(A tata enterprise)from about1 year .now i want to move to testing field as a fresher?Is this possible...can anyone give me a suggestion regarding d testing field.....

1806


Without the gui map, use the phy desc directly?

613


How to force wr to learn the sub-items on a menu?

554


Explain the purpose of different record methods?

630


What is the disadvantage of loading the GUI maps through start up scripts?

605


What is the use of test director testing tool?

689


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

1567


Which are default codes winrunner generates when we start the application?

1596