请问出现以下内容的提示是什么错误啊??????“access violation at address 00447418 in module 'project.

  • 主题发起人 主题发起人 dreameast-1
  • 开始时间 开始时间
D

dreameast-1

Unregistered / Unconfirmed
GUEST, unregistred user!
请问出现以下内容的提示是什么错误啊??????“access violation at address 00447418 in module 'project.exe'.read of address 00000030” (20分)<br />请问出现以下内容的提示是什么错误啊??????
“access violation at address 00447418 in module 'project.exe'.read of address 00000030”
 
呵呵,内存出错,访问了不该访问的内存
 
把原码贴出来看看。看这个没用。
 
我是把别的程序里的模块引用再我的程序中出现的问题,原码如下:unit uMgrUserF;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls, ExtCtrls, dbtables;

type
TMgrUserF = class(TFrame)
Button1: TButton;
Panel1: TPanel;
GroupBox1: TGroupBox;
ListView1: TListView;
GroupBox2: TGroupBox;
GroupBox3: TGroupBox;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
Button2: TButton;
GroupBox4: TGroupBox;
Edit1: TEdit;
Edit2: TEdit;
Button3: TButton;
StaticText1: TStaticText;
StaticText2: TStaticText;
ComboBox1: TComboBox;
StaticText3: TStaticText;
Panel2: TPanel;
StaticText4: TStaticText;
procedure Button1Click(Sender: TObject);
procedure RadioButton1Click(Sender: TObject);
procedure RadioButton2Click(Sender: TObject);
procedure ListView1Change(Sender: TObject; Item: TListItem;
Change: TItemChange);
procedure ListView1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure RefreshUser;
function GetUserPwd(UserName : string):string;
function CheckExistUserName(UserName : string):boolean;
procedure InsUser(UserName,UserPwd:string;Power : integer);
procedure UpdateUser(UserName,UserPwd:string;Power : integer);
procedure DelUser(UserName : string);
constructor Create(AOwner : TComponent);override;
end;

var
MgrUserF : TMgrUserF;

implementation

uses uMainF,uGloabVar;

{$R *.DFM}

procedure TMgrUserF.Button1Click(Sender: TObject);
begin
Parent := nil;
MainF.Caption := '图书管理系统';
end;

constructor TMgrUserF.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
try
RefreshUser;
except
ListView1.Items.Clear;
MessageDlg('得到用户信息出错',mtError,[mbok],0);
end;
ComboBox1.ItemIndex := 2;
end;

procedure TMgrUserF.RefreshUser;
var
Query : TQuery;
begin
Query := TQuery.Create(nil);
Query.DatabaseName := DBName;
Query.SQL.Add('select * from tsyhb order by Class ');
Query.Open;
ListView1.Items.Clear;
while not Query.Eof do
begin
with ListView1.Items.Add do
begin
Caption := Query.FieldByName('UserName').AsString;
SubItems.Add(Query.FieldByName('Class').AsString);
end;
Query.Next;
end;
Query.Close;
Query.Free;
end;

procedure TMgrUserF.RadioButton1Click(Sender: TObject);
begin
Edit1.Enabled := True;
Edit1.Color := clWindow;
end;

procedure TMgrUserF.RadioButton2Click(Sender: TObject);
begin
Edit1.Enabled := False;
Edit1.Color := clBtnFace;
end;

function TMgrUserF.GetUserPwd(UserName: string): string;
var
Query : TQuery;
begin
try
Query := TQuery.Create(nil);
Query.DatabaseName := DBName;
Query.SQL.Add('select UserPwd from tsyhb where UserName =:UserName');
Query.ParamByName('UserName').AsString := UserName;
Query.Open;
Result := Query.FieldByName('UserPwd').AsString;
Query.Close;
Query.Free;
except
Result := '';
end;
end;

procedure TMgrUserF.ListView1Change(Sender: TObject; Item: TListItem;
Change: TItemChange);
begin
if ListView1.Selected &lt;&gt; nil then
begin
Edit1.Text := ListView1.Selected.Caption;
Edit2.Text := GetUserPwd(Edit1.Text);
ComboBox1.ItemIndex := StrToInt(ListView1.Selected.SubItems.Strings[0]);
end;
end;

procedure TMgrUserF.ListView1Click(Sender: TObject);
begin
if ListView1.Selected &lt;&gt; nil then
begin
Edit1.Text := ListView1.Selected.Caption;
Edit2.Text := GetUserPwd(Edit1.Text);
ComboBox1.ItemIndex := StrToInt(ListView1.Selected.SubItems.Strings[0]);
end;
end;

function TMgrUserF.CheckExistUserName(UserName: string): boolean;
var
Query : TQuery;
begin
try
Query := TQuery.Create(nil);
Query.DatabaseName := DBName;
Query.SQL.Add('select UserName from tsyhb where UserName =:UserName');
Query.ParamByName('UserName').AsString := UserName;
Query.Open;
Result := Query.RecordCount &gt;0;
Query.Close;
Query.Free;
except
Result := False;
end;
end;

procedure TMgrUserF.DelUser(UserName: string);
var
Query : TQuery;
begin
Query := TQuery.Create(nil);
Query.DatabaseName := DBName;
Query.SQL.Add('delete from tsyhb where UserName =:UserName');
Query.ParamByName('UserName').AsString := UserName;
Query.ExecSQL;
Query.Free;
end;

procedure TMgrUserF.InsUser(UserName, UserPwd: string; Power: integer);
var
Query : TQuery;
begin
Query := TQuery.Create(nil);
Query.DatabaseName := DBName;
Query.SQL.Add('insert into tsyhb(UserName,UserPwd,Class) '+
'values(:UserName,:UserPwd,:Class)');
Query.ParamByName('UserName').AsString := UserName;
Query.ParamByName('UserPwd').AsString := UserPwd;
Query.ParamByName('Class').AsInteger:= Power;
Query.ExecSQL;
Query.Free;
end;

procedure TMgrUserF.UpdateUser(UserName, UserPwd: string; Power: integer);
var
Query : TQuery;
begin
Query := TQuery.Create(nil);
Query.DatabaseName := DBName;
Query.SQL.Add('update tsyhb set UserPwd=:UserPwd,Class=:Class'+
' where UserName=:UserName');
Query.ParamByName('UserName').AsString := UserName;
Query.ParamByName('UserPwd').AsString := UserPwd;
Query.ParamByName('Class').AsInteger:= Power;
Query.ExecSQL;
Query.Free;
end;

procedure TMgrUserF.Button3Click(Sender: TObject);
begin
if RadioButton1.Checked then
begin
if CheckExistUserName(Edit1.Text) then
begin
MessageDlg('此用户已经存在',mtError,[mbok],0);
Exit;

end;
try
InsUser(Edit1.Text,Edit2.Text,ComboBox1.ItemIndex);
except
MessageDlg('新建用户出错',mtError,[mbok],0);
Exit;
end;
end;
if RadioButton2.Checked then
begin
try
UpdateUser(Edit1.Text,Edit2.Text,ComboBox1.ItemIndex);
except
MessageDlg('修改用户出错',mtError,[mbok],0);
Exit;
end;
end;
Edit1.Text := '';
Edit2.Text := '';
ComboBox1.ItemIndex := 2;
RefreshUser;
end;

procedure TMgrUserF.Button2Click(Sender: TObject);
var
i : integer;
begin
for i := ListView1.Items.Count -1 downto 0 do
if ListView1.Items.Selected then
try
DelUser(ListView1.Items.Caption);
ListView1.Items.Delete(i);
except
MessageDlg('删除用户&lt;'+ListView1.Items.Caption+'&gt;出错',mtError,[mbok],0);
end;
end;

end.主要的功能就是向一表中更新数据而已.
 
kao,这种提示太高深了。别人怎能知道是何原因。只能你仔细检查自己的代码了。:(
 
一般是“随机”访问冲突,重新启动Delphi,甚至重启机器看是否还出现。
 
应该是你在访问一个对象时,它却还没有被创建;
 
同意 1疯狂delphi
1. 检查工程启动代码,
2. MainF.Caption := '图书管理系统';
的 MainF ??

 
多人接受答案了。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
666
import
I
I
回复
0
查看
977
import
I
I
回复
0
查看
948
import
I
后退
顶部