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 is the purpose of set_window command?

707


What do you verify with the database check point custom and what command it generates, explain syntax?

620


How to get the resolution settings?

587


Without the gui map, use the phy desc directly?

605


How can withwin runner to make single scripts which supports multiple languages?

606






What is tsl? What 4gl is it similar too?

754


How do you suppress a regular expression?

1488


What are the Win Runner tools for functional testing?

2522


hi this is uday iam trying for testing job with 3+ yrs of exp if u have qtp faqs materil plz send me thanks in advance

1589


What is the difference between gui map and gui map files?

560


How do you maintain the document information of the test scripts?

576


Welcome link is dynamic. How do you handle? What is your approach and write script.plz send answer

1629


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

595


i would like to know the steps to write tsl exception and object exception with a simple example

1681


Explain the purpose of loading winrunner add-ins?

633