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
How do you call windows APIs, explain with an example?
What are the Win Runner tools for functional testing?
Have you ever created a start-up script?
What is the purpose of a gui spy?
What Framework is suitable to validate the Login screen.
What is the purpose of gui map configuration?
i would like to know the steps to write tsl exception and object exception with a simple example
What are data driven tests?
What is the use of gui map and what happens when gui map file get loaded?
What is the purpose of regexp_label property and regexp_msw_class property?
Have you used winrunner in your project?
What is the purpose of gui spy?
How do you handle unexpected events and errors?
How do you select multiple objects during merging the files?
soft key for virtual object wizard ?