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
What are the Win Runner tools for functional testing?
Name the different modes of recording?
what are the differences you see in e-commerce and banking domain in testing point of view Thanks in Advance
what is risk?
What is the purpose of gui spy?
global sheet and external excel sheet how it will work
How should we write and execute a user define function using WinRunner.
What do you verify with the database check point custom and what command it generates, explain syntax?
What are the virtual objects and how do you learn them?
How to find the local host name using winrunner ?
What are data driven tests?
Where do you found that you can't use winrunner for automation?
What is the purpose of regexp_msw_class property?
what is the use of generate script that is avaliable 3 places(file settings, tools, object identification)
For my web Application I am recording website by WR. but the fuctions are displaying normal recorded fun. such as set_window...etc. eventhough i selected web add-in at start up WR. how to use web functions? such as web_link_click.... pls. guide