
26.11.2010, 15:21
|
Местный
|
|
Регистрация: 31.05.2010
Адрес: Москва
Сообщения: 466
Версия Delphi: 7
Репутация: 40
|
|
примерно в эту :
Код:
excel := createoleobject('excel.application');
excel.workbooks.open(sedit1.text,false);
workbook:=excel.workbooks.item[1];
sheet := workbook.worksheets[1];
sheet.cells.specialcells(xlcelltypelastcell,emptyparam).activate;
y := excel.activecell.row;
for i:=2 to y do
begin
//Выбор данных из Ёкселя
st1:=trim(sheet.cells[i,1]);
st2:=trim(sheet.cells[i,2]);
st3:=trim(sheet.cells[i,3]);
st4:=trim(sheet.cells[i,4]);
st5:=trim(sheet.cells[i,5]);
st6:=trim(sheet.cells[i,6]);
//Вызов ХП
lk.TransactionID := 1;
lk.IsolationLevel := xilREADCOMMITTED;
if SQLConnection1.InTransaction then SQLConnection1.Commit(lk);
SQLConnection1.StartTransaction(lk);
try
ibquery1.Active:=false;
ibquery1.ParamByName('GR').Value:=copy(st1,1,50);
ibquery1.ParamByName('ART').Value:=copy(st2,1,30);
ibquery1.ParamByName('NM').Value:=copy(st3,1,50);
ibquery1.ParamByName('DL').Value:=strtofloat(copy(st4,1,30));
ibquery1.ParamByName('RT').Value:=strtofloat(copy(st5,1,30));
ibquery1.ParamByName('rtsp').Value:=strtofloat(copy(st6,1,30));
ibquery1.ParamByName('DT').Value:=dateof(sDateEdit1.Date);
if isDealerNds=NDSno then ibquery1.ParamByName('ndl').Value:=0
else ibquery1.ParamByName('ndl').Value:=1;
if isRetailNDS=NDSno then ibquery1.ParamByName('nrt').Value:=0
else ibquery1.ParamByName('nrt').Value:=1;
if isRetailShopNDS=NDSno then ibquery1.ParamByName('nrtsp').Value:=0
else ibquery1.ParamByName('nrtsp').Value:=1;
IBQuery1.Active:=true;
SQLConnection1.Commit(lk);
if ibquery1.FieldByName('ID').IsNull then begin
idf:= -1;
end
else idf:=ibquery1.FieldByName('ID').AsInteger;
except
on e:Exception do
begin
SQLConnection1.Rollback(lk);
idf:=-1;
end;
end;
.....
if not VarIsEmpty(Excel) then excel.quit;
__________________
Новый вирус - "БОМЖ"! Он просто роется в Корзине...и спит под ярлычком "Сетевое окружение"
|