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 in contained in the GUI map?
Explain the winrunner testing process?
What is debug mode in Winrunner?
what is mean by release in quality center and who will perfom?
what is the use of generate script that is avaliable 3 places(file settings, tools, object identification)
Explain the purpose of gui map configuration?
How to check the background colour of the screen in WR?
plz give me code or steps for pop up exception. or can u tell me how to pause test run for defining handler function?
how can you explain your Real Estate Project in front of interviewer..? please step by step......
Explain data parameterization in winrunner?
what is risk?
Name the different types of checkpoints?
What is the difference between writing a function and writing a script?
How to test Fonts and its size thru "Font Expert" in Win Runner.
Name the three modes of running the scripts?