How increases the performance between excel to datasource

I have a excel with 1000 records i need to fetch that and insert in to my table i used the normal coding and also insert_set concept but my performace of that program is too slow…

Could any one Can Help me to increases the performance of data transfer between excel to table

Can you show us the code which have you used for data importing ?

Regards,

Faisal Raja J

Lev_CompanyDetails Table,tabletmp;
sysexcelapplication application;
sysexcelworkbooks workbooks;
sysexcelworkbook workbook;
sysexcelworksheets worksheets;
sysexcelworksheet worksheet;
sysexcelcells cells;
sysexcelrange range,totrange;
comvarianttype type;
filenameopen fopen;
dialog dia;
dialogfield diafield;
int row,i;
#excel
#avifiles
str COMVariant2Str(COMVariant _cv, int _decimals = 0, int _characters = 0, int _separator1 = 0, int _separator2 = 0)
{
switch (_cv.variantType())
{
case (COMVariantType::VT_BSTR):
return _cv.bStr();

case (COMVariantType::VT_R4):
return num2str(_cv.float(),_characters,_decimals,_separator1,_separator2);

case (COMVariantType::VT_R8):
return num2str(_cv.double(),_characters,_decimals,_separator1,_separator2);

case (COMVariantType::VT_DECIMAL):
return num2str(_cv.decimal(),_characters,_decimals,_separator1,_separator2);

case (COMVariantType::VT_DATE):
return date2str(_cv.date(),123,2,1,2,1,4);

case (COMVariantType::VT_EMPTY):
return “”;

default:
throw error(strfmt("@SYS26908", _cv.variantType()));
}
return “”;
} ;
tabletmp.setTmp();
dia=new dialog(“Select the File”);
diafield=dia.addField(typeid(filenameopen));
if(dia.run())
{
fopen=diafield.value();
info(strfmt(“Select File is :%1”,fopen));
application=sysexcelapplication::construct();
workbooks=application.workbooks();
workbooks.open(fopen);
info(“Your File Successfully Opened…”);
workbook=workbooks.item(1);
worksheets=workbook.worksheets();
worksheet=worksheets.itemFromNum(1);
cells=worksheet.cells();
totrange=cells.range(#ExcelDatarange);
//totrange=worksheet.cells().range(#ExcelDataRange);
range = totrange.find("*", null, #xlFormulas, #xlWhole,#xlByRows,#xlPrevious);
info(strfmt(“Number Rows to be copied is: %1”,range.row()));
row=range.row();
for(i=2;i<=row;i++)
{
tabletmp.Company_id= str2int(COMVariant2Str(cells.item(i,1).value()));
tabletmp.Company_Name=comvariant2str(cells.item(i,2).value());
tabletmp.insert();

info(strfmt("%1 row inserted",i));
}
insert_recordset table (Company_id,Company_Name) select Company_id,Company_Name from tabletmp;
info(“Process Completed”);
application.workbooks().close();
application.quit();

}

sry faisal i can’t send full progrAM

Lev_CompanyDetails Table,tabletmp;
filenameopen fopen;
dialog dia;
dialogfield diafield;
int row,i;
#excel
#avifiles
str COMVariant2Str(COMVariant _cv, int _decimals = 0, int _characters = 0, int _separator1 = 0, int _separator2 = 0)
{
switch (_cv.variantType())
{
case (COMVariantType::VT_BSTR):
return _cv.bStr();

case (COMVariantType::VT_R4):
return num2str(_cv.float(),_characters,_decimals,_separator1,_separator2);

case (COMVariantType::VT_R8):
return num2str(_cv.double(),_characters,_decimals,_separator1,_separator2);

case (COMVariantType::VT_DECIMAL):
return num2str(_cv.decimal(),_characters,_decimals,_separator1,_separator2);

case (COMVariantType::VT_DATE):
return date2str(_cv.date(),123,2,1,2,1,4);

case (COMVariantType::VT_EMPTY):
return “”;

default:
throw error(strfmt("@SYS26908", _cv.variantType()));
}
return “”;
} ;
tabletmp.setTmp();
dia=new dialog(“Select the File”);
diafield=dia.addField(typeid(filenameopen));
if(dia.run())
{
fopen=diafield.value();
info(strfmt(“Select File is :%1”,fopen));
application=sysexcelapplication::construct();
workbooks=application.workbooks();
workbooks.open(fopen);
info(“Your File Successfully Opened…”);
workbook=workbooks.item(1);
worksheets=workbook.worksheets();
worksheet=worksheets.itemFromNum(1);
cells=worksheet.cells();
totrange=cells.range(#ExcelDatarange);
range = totrange.find("*", null, #xlFormulas, #xlWhole,#xlByRows,#xlPrevious);
info(strfmt(“Number Rows to be copied is: %1”,range.row()));
row=range.row();
for(i=2;i<=row;i++)
{
tabletmp.Company_id= str2int(COMVariant2Str(cells.item(i,1).value()));
tabletmp.Company_Name=comvariant2str(cells.item(i,2).value());
tabletmp.insert();

info(strfmt("%1 row inserted",i));
}
insert_recordset table (Company_id,Company_Name) select Company_id,Company_Name from tabletmp;
info(“Process Completed”);
application.workbooks().close();
application.quit();

}

help me any one pls

help me any one help

Why are you using temptable for inserting record into your table?

Why can’t you insert directly into your table ?

Share me your email Id, I will send you an xpo of sample data import.

Regards,
Faisal Raja J

i used that also faisal hat also takes same timing to complete the process

anyway give ur idea man

manimaran.kasi@levergent.com