Тема: Циклы
Показать сообщение отдельно
  #3  
Старый 17.02.2011, 13:07
Error Error вне форума
Прохожий
 
Регистрация: 10.01.2007
Сообщения: 33
Репутация: 10
По умолчанию

Все равно виснет.
Вот полный код
Код:
procedure TForm1.Button1Click(Sender: TObject);
var
c1, c2 : integer;
CheckSet: Set of Byte;
begin
  CheckSet := [1..5];
  randomize;
  repeat
     c1:=RandomRange(1,5);
     Exclude(CheckSet, c1);
  until (not AdoTable1.Locate('c1',c1,[loCaseInsensitive])) or (CheckSet = []);

if AdoTable1.Locate('Name',Edit1.Text,[loCaseInsensitive]) then
ShowMessage('Warning!')
else
AdoQuery1.SQL.Clear;
AdoQuery1.SQL.Text:='Insert Into reg (a1, a2, c1, c2) values (:param1, :param2, :param3, :param4)';
AdoQuery1.Parameters.ParamByName('param1').Value:=edit1.Text;
AdoQuery1.Parameters.ParamByName('param2').Value:=rg1.ItemIndex;
AdoQuery1.Parameters.ParamByName('param3').Value:=c1;
AdoQuery1.Parameters.ParamByName('param4').Value:=c2;
AdoQuery1.ExecSQL;
AdoTable1.Active:=false;
AdoTable1.Active:=true;
end;
Ответить с цитированием