Форум: "Основная";
Текущий архив: 2002.06.03;
Скачать: [xml.tar.bz2];
ВнизВыручайте горю Найти похожие ветки
← →
ruslan_as (2002-05-22 09:14) [0]Программу закончил. Последняя поправка и ...Ошибка! (уж очень гладко шла...).
VarCmp Error: Lt=0; Rt=256; Op=14.
Вылетает при выполнении следующего кода
if LocupResultCeh="013" then OTD_SQL:="";
Вот более полный код
procedure TfmLimit.SpeedButton1Click(Sender: TObject);
var WorkBook,Excel,Sheet,LocupResultCeh,LocupResultPeriod:Variant;
SQL_,SQL_0,God_SQL,OTD_SQL,CEH_SQL,Vid_SQL,Period_SQL:string;
i,n:integer;
begin
Excel:=CreateOLEObject("Excel.Application");
Excel.WorkBooks.add;
Sheet := Excel.Application.Worksheets.Item[1];
DM.odsPodrazd.First;
i:=8;
n:=0;
while not DM.odsPodrazd.Eof do
begin
LocupResultPeriod:=dm.clMonth.Lookup ("Combo",DBLookupComboBox2.Text,"SQL_Text");
if LocupResultPeriod="" then begin ShowMessage("Ошибка в блоке dm.clMonth! Обращаться в АСУ!");exit; end;
God_SQL:=" and z.GOD="+chr(39)+fmStart.Edit1.Text+chr(39);
Period_SQL:=LocupResultPeriod;
CEH_SQL:=" and z.K_CEH="+chr(39)+DM.odsPodrazd.FieldByName("KOD").AsString+chr(39);
if ComboBox3.Text="Общий" then VID_SQL:=""
else VID_SQL:=" and z.VID="+chr(39)+ComboBox3.Text+chr(39);
SQL_0:="where t.KOD=z.KOD "+God_SQL+CEH_SQL+Vid_SQL+
" and t.K_ISP_D<>"+chr(39)+"66"+chr(39)+
" and t.K_ISP_D<>"+chr(39)+"62"+chr(39)+
" and t.K_ISP_D<>"+chr(39)+"61"+chr(39)+
" and t.K_ISP_D<>"+chr(39)+"60"+chr(39)+
" and t.K_ISP_D<>"+chr(39)+"59"+chr(39)+
" and t.K_ISP_D<>"+chr(39)+"58"+chr(39)+
" and t.K_ISP_D<>"+chr(39)+"65"+chr(39)+
" and t.K_ISP_D<>"+chr(39)+"57"+chr(39);
Excel.Cells[i,1].value:=IntToStr(n);
Excel.Cells[i,2].value:=DM.odsPodrazd.FieldByName("NAME_U").AsString;
//Механик
OTD_SQL:=" and t.KOD like "+chr(39)+"01%"+chr(39);
SQL_:=SQL_0+OTD_SQL;
Excel.Cells[i,3].value:=FloatToStr(RoundTo(SQL_Limit(Period_SQL,SQL_),-2));
//Энергетик
OTD_SQL:=" and t.KOD like "+chr(39)+"02%"+chr(39)+" and t.KOD not like "+chr(39)+"0201602%"+chr(39);
SQL_:=SQL_0+OTD_SQL;
Excel.Cells[i,4].value:=FloatToStr(RoundTo(SQL_Limit(Period_SQL,SQL_),-2));
//Метролог
OTD_SQL:=" and t.KOD like "+chr(39)+"03%"+chr(39);
SQL_:=SQL_0+OTD_SQL;
Excel.Cells[i,5].value:=FloatToStr(RoundTo(SQL_Limit(Period_SQL,SQL_),-2));
//ОКС
OTD_SQL:=" and t.KOD like "+chr(39)+"04%"+chr(39);
SQL_:=SQL_0+OTD_SQL;
Excel.Cells[i,6].value:=FloatToStr(RoundTo(SQL_Limit(Period_SQL,SQL_),-2));
//ОМТР+ГСМ
OTD_SQL:=" and t.KOD like "+chr(39)+"06%"+chr(39)+
" and t.KOD not like " + chr(39)+"06005%" + chr(39)+
" and t.KOD not like " + chr(39)+"06006%" + chr(39)+
" and t.KOD not like " + chr(39)+"06007%" + chr(39)+
" and t.KOD not like " + chr(39)+"06009%" + chr(39)+
" and t.KOD not like " + chr(39)+"0600201%" + chr(39)+
" and t.KOD not like " + chr(39)+"0600202%" + chr(39)+
" and t.KOD not like " + chr(39)+"0600203%" + chr(39)+
" and t.KOD not like " + chr(39)+"0600204%" + chr(39)+
" and t.KOD not like " + chr(39)+"0600205%" + chr(39)+
" and t.KOD not like " + chr(39)+"0600206%" + chr(39)+
" and t.KOD not like " + chr(39)+"0600207%" + chr(39)+
" and t.KOD not like " + chr(39)+"0600208%" + chr(39);
if LocupResultCeh="013" then OTD_SQL:="";//Вот тут вылетает
...
end;
← →
Donal_Graeme (2002-05-22 09:28) [1]а зачем так хитро то? если LocupResultCeh - строка, то и объяви её строкой.. нафига с вариантами мучаться? :-)
← →
ruslan_as (2002-05-22 12:35) [2]Верно! Спасибо!
Только чего это было VarCmp Error: Lt=0; Rt=256; Op=14
Самое интересное, на соседней форме этот цикл работает...
Страницы: 1 вся ветка
Форум: "Основная";
Текущий архив: 2002.06.03;
Скачать: [xml.tar.bz2];
Память: 0.45 MB
Время: 0.008 c