我实在是不会用数据库,帮我看一下吧。
一个是实现每次开始时读入一个随机的手机号作为开始
二是删除的时候不删除数据库里的内容。
我真的快疯了,大家帮帮忙吧
procedure TForm1.Button1Click(Sender: TObject);
begin
timer1.Enabled :=True;
Button2.SetFocus;
end;procedure TForm1.Timer1Timer(Sender: TObject);
begin
if adodataset1.Eof then
ADODataSet1.FIRST
else
adodataset1.Next;
ADODataSet1.MoveBy(random(30));
end;procedure TForm1.Button2Click(Sender: TObject);
begin
timer1.Enabled :=false;
label3.Caption :=dbtext1.Caption;
adodataset1.Close;
ADODataSet1.CommandText:='select * from MobileNumber where MobileNum<>'+''''+label3.Caption+'''';
adodataset1.Open;
adodataset1.Delete;
Memo1.Lines.Add(label3.Caption);
Button1.SetFocus;
end;procedure TForm1.Button3Click(Sender: TObject);
begin
Application.Terminate;
end;

解决方案 »

  1.   

    随机选出一个号码,然后把这个号码删除(不要删数据库的),再选出一个号,一直到无号可选,把每次选出的号放在MEMO里。
      

  2.   

    procedure TForm1.Button2Click(Sender: TObject);
    Var
      I :Integer;
    begin
    timer1.Enabled :=false;
    I := Memo1.Lines.IndexOf(dbtext1.Caption);
    While I=-1 Do
    Begin
     If adodataset1.Re=Memo1.Lines.Count Then 
     Begin
       showmessage('记录已取完!');
       Exit;
     End; If adodataset1.Eof then
        ADODataSet1.FIRST
     else
        adodataset1.Next;
     
     I := Memo1.Lines.IndexOf(dbtext1.Caption);
    end;
    adodataset1.Close;
    label3.Caption :=dbtext1.Caption;
    Memo1.Lines.Add(label3.Caption);
    Button1.SetFocus;
    end;
      

  3.   

    procedure TForm1.Button2Click(Sender: TObject);
    Var
      I :Integer;
    begin
    timer1.Enabled :=false;
    I := Memo1.Lines.IndexOf(dbtext1.Caption);
    While I=-1 Do
    Begin
     If adodataset1.Re=Memo1.Lines.Count Then 
     Begin
       showmessage('记录已取完!');
       Exit;
     End; If adodataset1.Eof then
        ADODataSet1.FIRST
     else
        adodataset1.Next;
     
     I := Memo1.Lines.IndexOf(dbtext1.Caption);
    end;
    adodataset1.Close;
    label3.Caption :=dbtext1.Caption;
    Memo1.Lines.Add(label3.Caption);
    Button1.SetFocus;
    end;