我用ADO QUERY连接数据库,一直都没出错,但昨天突然出错了,我用一个定时每隔1秒就对数据库写入一次,当我登录时就会随机性地出错,两个操作不是同一个QUERY,后来我干脆再加一个对数据库的连接(两个每个都对应一个数据库连接),但是问题依旧。
下面是错误信息。
Project airProject.exe raised exception class EAccessViolation with message 'Access
violation at address 00000008. Read of address 00000008'. Process stopped. Use Step
or run to continue.
哪位大哥大姐帮帮忙啊!

解决方案 »

  1.   

    procedure TloginFrm.passwordEdtKeyPress(Sender: TObject; var Key: Char);
    begin
    if key=#13 then
      begin
      DataModule1.ADOQuery1.Close;
      DataModule1.ADOQuery1.sql.Clear;
      DataModule1.ADOQuery1.SQL.Add('select * from [user] where name='''+trim(ComboBox1.Text)+''' and Password='''+md5.MD5Print(md5.MD5String(passwordedt.Text))+'''');
      DataModule1.ADOQuery1.open;
      if DataModule1.ADOQuery1.RecordCount>=1 then
        begin
        picfrm.Name:='';
        picfrm.Name:=DataModule1.ADOQuery1.FieldByName('name').AsString;
        picfrm.Purview:='';
        picfrm.Purview:=DataModule1.ADOQuery1.FieldByName('Purview').AsString;
        DataModule1.ADOQuery1.Close;
        loginfrm:=nil;
        free;
        picfrm.Hide;
        mainfrm.Show;
        end
      else
        begin
        picfrm.inpasscount:=picfrm.inpasscount+1;
        if picfrm.inpasscount>=3 then
          begin
          mainfrm.msg.Caption:='警告';
          mainfrm.msg.Text:='密码三次错误,在一段时间内您将无法登录!';
          mainfrm.msg.ShowModal;
          mainfrm.TimerList.Items[2].Enabled:=true;
          DataModule1.ADOQuery1.Close;
          loginfrm:=nil;
          free;
          end
        else
          begin
          mainfrm.msg.Caption:='提示';
          mainfrm.msg.Text:='密码错误,请重新输入!';
          mainfrm.msg.ShowModal;
          passwordedt.SetFocus;
          passwordedt.SelectAll;
          end;
        end;
      end;
    end;
    要怎么释放啊,就只有这么一段啊,救命啊~~!@~!
      

  2.   

    loginfrm:=nil;
        free;
        picfrm.Hide;
        mainfrm.Show;    picfrm.Hide;
        mainfrm.Show;
        loginfrm:=nil;
        free;
      

  3.   

    loginfrm:=nil;
        free;
        picfrm.Hide;
        mainfrm.Show;
    改成
        picfrm.Hide;
        mainfrm.Show;
        loginfrm:=nil;
        free;
    没用啊,还是一样,55555555555
    @!¥#……#¥
      

  4.   

    都去吃饭了?怎么都没人了!
    谁知道把byte类型的,即16进制$a1这种改成字符型显示吗?
    最好是函数,自已算我也会
    照样给分咯
      

  5.   

    loginFrm.close()
    begin
    action := cafree;
    loginFrm :=nil;
    end;还有就是你的一个Query是不是既做了数据感知控件的的显示,有做了查询。
      

  6.   

    loginFrm.close()
    begin
    action := cafree;
    loginFrm :=nil;
    end;
    这样还是不行query没有做两项,每一项对应一个query
    谁知道把byte类型的,即16进制$a1这种改成字符型显示吗?
    最好是函数,自已算我也会
    弄出来一样给分啦
      

  7.   

    loginfrm:=nil;
        free;   把这些去掉
      

  8.   

    free释放窗口的loginfrm:=nil;
        free;   为什么要把这些去掉
    只放一个CLOSE吗?