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

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.

1546


Have you used winrunner in your project?

583


What different actions are performed by find and show button?

648


global sheet and external excel sheet how it will work

1403


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

1022






How to to get the information from the status bar without doing any activity/click on the hyperlink?

584


How should we write and execute a user define function using WinRunner.

1627


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

598


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

537


How do you load GUI map?

687


What are the synchronization points?

642


How to break infinite loop?

653


Name the different types of checkpoints?

592


What is toogle breakpoints? How does it differ from break points?

1786


I want to do smoke test in my application but i have learnt the application before recording but im getting an error class name not found while running the script.I want to check each links and each text in my application. Can anybody answer my quesion plz.If it is possible i want test script for Yahoo login form with "New User" Login.

1632