刚学delphi就遇到问题,都看不懂,它显示错误:
    Project Project1.exe raised exception class EAccessViolation with message 'Access violation at address 004C14E5 in module 'Project1.exe'. Read of address 0000005C'. Process stopped. Use Step or Run to continue.    大家帮帮忙啊!

解决方案 »

  1.   

    procedure TBookForm.TabSheet2Show(Sender: TObject);
    var
      i:integer;
    begin
      ComboBox1.Items.Clear;
      with DataModule7.ADOQuery1 do
      begin
         SQL.Clear;
         SQL.Add('select Code from TL.TL.dbo.Book');
         Open;
         First;
         for i:=0 to RecordCount-1 do
         begin
           ComboBox1.Items.Add(FieldbyName('Code').AsString);
           Next;
         end;
         Close;
      end;
    end;
    它指示地方为with DataModule7.ADOQuery1 do
      

  2.   

    幫助說明:
    EAccessViolation is the exception class for invalid memory access errors.EAccessViolation is raised when an applicationDereferences a nil (Delphi) or NULL (C++) pointer.
    Writes to memory reserved for executable code.
    Attempts to access a memory address for which there is no virtual memory allocated to the application.當引用一個空指針時報錯.即是最容易出現的'報地址錯';請看這段代碼:
    procedure TForm1.BitBtn1Click(Sender: TObject);
    begin
      //sender:=nil;  //將指針設為空, 即它沒有指向任何對象.
      //sender.free;  //或將這個對象釋放
      showmessage(sender.ClassName); //設置上面任何一行代碼就會引發這個异常
    end;
      

  3.   

    帮助说明我看了,知道什么意思,可是就是不知道为什么with DataModule7.ADOQuery1 do引用了空指针.我在将数据写入数据库时用它都没发生错误
      

  4.   

    你程序的DataModule7 對象有沒有創建?"????
      

  5.   

    TDataModule7 = class(TDataModule)这样算不算啊?我新建DataModule时它自己生成的
      

  6.   

    还有这个DataModule7: TDataModule7
      

  7.   

    begin
      Application.Initialize;  Application.CreateForm(TDataModule7, DataModule7);  //有了這行就可以了  Application.CreateForm(TForm1, Form1);
      Application.Run;
    end.