Access violation at address 004A4717 in module 'xxx.exe'. Read of address 0000009D这是我其中一个窗体要看打印预览时,会出现的错误提示。但我程序里的其他窗体也有调用同一个rav,就不会出现这种错误。而且这个窗体所进行的所有打印预览都不正常,有时不出现上面的错误了,但又会调用数据库里某一条记录预览,第一次会是正确的,数据内容就是我要抽出来的那条数据。但当我选第二条数据来打印预览时,预览的内容就不会变了,依然是第一次的数据内容,第三次,第四次都一样,出现的依然是第一次的数据内容。请问有人遇到过这种情况吗?能告诉我解决的办法吗?非常感谢,问题如果能解决的话,马上给分,绝不赖帐。
解决方案 »
- 听说阿泰千金周岁?
- 修改工具栏,菜单栏的背景色
- 服务器端接收客户端发送的字符串应该怎么做?在线等。。。。。。。。。。。
- 下载组件。。。。。
- 怎样使一个窗口在初始最大化后只能最小化和最大化?可以象vc的窗口那样使得最大化和最小中间的那个钮灰掉吗
- 寻找 maozefa(之源) !!!!!密我!!!!!1
- 如何建立一个分辨率为200像素/英寸的Bitmap?
- 如何使桌面右下角的小图标闪烁???急!!!!!!!!!!!!!!!
- 数据库中有一员工表,我想利用它直接做个打印胸卡的小程序,请问各位有什么好的意见?谢谢!
- 急!关于ado的错误,
- 如何把一个vc的dll工程文件的入口 修改成可以供delphi调用 谢谢
- Either EOF or BOF is True, or the current record has been deleted. Requested operation ......
随便加2句看看试试,
Form1.Active:=false;
Form1.Active:=true;
这个问题已经捆绕了我很久了。谢谢unit QueryUnit;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ImgList, ComCtrls, ToolWin, Grids, DBGrids, DB,
DBClient, ADODB, RpDefine, RpRave, RpCon, RpConDS;type
TQueryForm = class(TForm)
QueryGB: TGroupBox;
InvoGB: TGroupBox;
QuotationIDLB: TLabel;
OwerLB: TLabel;
LicenceLB: TLabel;
ToolBar1: TToolBar;
QueryTB: TToolButton;
ExitTB: TToolButton;
UserIL: TImageList;
QuotaIDED: TEdit;
ClientED: TEdit;
LicenceED: TEdit;
InvoiceIDLB: TLabel;
InvoiceIDED: TEdit;
CliceED: TLabel;
OwerED: TEdit;
InvLicenceLB: TLabel;
InvLicenceED: TEdit;
ShowGB: TGroupBox;
QueryDS: TDataSource;
QueryQu: TADOQuery;
ShowDBDbl: TDBGrid;
SearchPC: TPageControl;
QuotationTS: TTabSheet;
InvoiceTS: TTabSheet;
Show2GB: TGroupBox;
InvoiceDB: TDBGrid;
invDS: TDataSource;
invQu: TADOQuery;
StartDT: TDateTimePicker;
EndDT: TDateTimePicker;
Label1: TLabel;
Label2: TLabel;
Start1DT: TDateTimePicker;
End1DT: TDateTimePicker;
Label3: TLabel;
Label4: TLabel;
PrintBT: TToolButton;
ImageList1: TImageList;
QueryRVP: TRvProject;
InvoiceRVP: TRvProject;
QueryRVC: TRvDataSetConnection;
LabourRVC: TRvDataSetConnection;
PartRVC: TRvDataSetConnection;
LabourQu: TADOQuery;
PartsQu: TADOQuery;
procedure FormShow(Sender: TObject);
procedure QueryTBClick(Sender: TObject);
procedure ShowDBDblClick(Sender: TObject);
procedure ExitTBClick(Sender: TObject);
procedure PrintBTClick(Sender: TObject);
private
{ Private declarations }
function CheckData : Boolean;
procedure EnableQuota;
procedure EnableInvo;
procedure UnableQuota;
procedure UnableInvo;
procedure ClearAll;
public
{ Public declarations }
end;var
QueryForm: TQueryForm;implementationuses MainUnit,Unit_DB, QuotaSelUnit;{$R *.dfm}
function TQueryForm.CheckData : Boolean;
begin
Result := False;
case SearchPC.TabIndex of
0:
begin
if QuotaIDED.Text = '' then
if ClientED.Text = '' then
if LicenceED.Text = '' then
if DateToStr(startDT.DateTime)= DateToStr(Now) then
begin
ShowMessage('Please input at least one field, or you can not find anything!');
Exit;
end;
Result:= True;
end; 1:
begin
if InvoiceIDED.Text='' then
if OwerED.Text='' then
if InvLicenceED.Text='' then
if DateToStr(start1DT.DateTime)= DateToStr(Now) then
begin
ShowMessage('Please input at least one field, or you can not find anything!');
Exit;
end;
Result:= True;
end;end;
end;
begin
QuotaIDED.Enabled := True;
ClientED.Enabled := True;
LicenceED.Enabled := True;end;procedure TQueryForm.EnableInvo;
begin
InvoiceIDED.Enabled := True;
OwerED.Enabled := True;
InvLicenceED.Enabled := True;end;procedure TQueryForm.UnableQuota;
begin
QuotaIDED.Enabled := False;
ClientED.Enabled := False;
LicenceED.Enabled := False;end;procedure TQueryForm.UnableInvo;
begin
InvoiceIDED.Enabled := False;
OwerED.Enabled := False;
InvLicenceED.Enabled := False;end;procedure TQueryForm.ClearAll;
begin
QuotaIDED.Text := '';
ClientED.Text := '';
LicenceED.Text := ''; InvoiceIDED.Text := '';
OwerED.Text := '';
InvLicenceED.Text := ''; StartDT.DateTime := Now;
EndDT.DateTime := Now;
Start1DT.DateTime := Now;
End1DT.DateTime := Now;
end;procedure TQueryForm.FormShow(Sender: TObject);
begin
ClearAll;
EnableQuota;
EnableInvo;
end;procedure TQueryForm.QueryTBClick(Sender: TObject);
var
StrSQL,StrSQL1 : String;
begin
if CheckData then
begin
case SearchPC.TabIndex of
0:
begin
StrSQL := 'Select a.quota_id,a.licence,a.ref,a.policy,a.dat,a.memo,a.total,b.client_name,b.address,b.phone,c.car_licence,c.insurance,c.vehicle,c.mileage,c.chassis,c.engine'+
' from quotation a, client_table b,car_table c where a.client_id=b.client_id and b.client_id=c.client_id ';
if QuotaIDED.Text <> '' then
StrSQL1 := 'and a.quota_id ='+QuotaIDED.Text;
if ClientED.Text <> '' then
StrSQL1 := 'and a.client_id in (Select client_id from client_table where client_name like '+QuotedStr('%'+ClientED.Text+'%')+')' ;
if LicenceED.Text <> '' then
StrSQL1 := ' and a.licence like '+QuotedStr('%'+LicenceED.Text+'%');
if DateToStr(startDT.DateTime) <> DateToStr(Now) then
StrSQL1:= 'and a.dat between '+QuotedStr(DatetoStr(startDT.DateTime))+'and '+QuotedStr(DatetoStr(endDT.DateTime)); StrSQL:=StrSQL+StrSQL1;
with QueryQu do
begin
Close;
SQL.Text := StrSQL;
Open; if Eof then
begin
ShowMessage('There is no fix record in the Database!');
ClearAll;
end;
end;
end; 1:
begin
StrSQL := 'Select a.quota_id,a.licence,a.ref,a.policy,a.dat,a.memo,a.total,b.client_name,b.address,b.phone,c.car_licence,c.insurance,c.vehicle,c.mileage,c.chassis,c.engine,d.invno'+
' from quotation a, client_table b,car_table c,inv_table d where a.quota_id=d.quota_id and a.client_id=b.client_id and b.client_id=c.client_id' ; if InvoiceIDED.Text <> '' then
StrSQL := StrSQL+' and d.invno = '+InvoiceIDED.Text;
if OwerED.Text <> '' then
StrSQL := StrSQL + ' and a.client_id in (Select client_id from client_table where client_name like '+QuotedStr('%'+OwerED.Text+'%')+')';
if InvLicenceED.Text <> '' then
StrSQL := StrSQL + ' and a.licence like '+QuotedStr('%'+QuotedStr(LicenceED.Text)+'%');
if DateToStr(start1DT.DateTime) <> DateToStr(Now) then
StrSQL := StrSQL + ' and a.dat between '+QuotedStr(DatetoStr(start1DT.DateTime))+'and '+QuotedStr(DatetoStr(End1DT.DateTime)); with invQu do
begin
Close;
SQL.Text := StrSQL;
Open; if Eof then
begin
ShowMessage('There is no fix record in the Database!');
ClearAll;
end;
end;
end;
end; end;end;procedure TQueryForm.ShowDBDblClick(Sender: TObject);
var
StrSQL,StrSQL1,StrSQL2 : String;
QuotaID: String;
begin if Application.FindComponent('QuotaSelUnit')=nil then
Application.CreateForm(TQuotaSelForm,QuotaSelForm); case SearchPC.TabIndex of
0:
begin
QuotaID := ShowDBDbl.Fields[0].AsString;
StrSQL:='Select * from quotation a, client_table b,car_table c where '+
'a.client_id=b.client_id and b.client_id=c.client_id and a.quota_id= '+QuotaID;
StrSQL1 :='Select * from quota_labour where quota_id = '+QuotaID;
StrSQL2 := 'Select * from quota_parts a, part b where a.part_id=b.part_id and quota_id = '+QuotaID;
QuotaSelForm.QutoOrInvo(0);
end;
1:
begin
QuotaID :=InvoiceDB.Fields[0].AsString;
StrSQL:='Select * from quotation a,client_table b,car_table c ,inv_table d where '+
'a.client_id=b.client_id and b.client_id=c.client_id and a.quota_id=d.quota_id and d.invno = '+QuotaID; StrSQL1 :='Select * from quota_labour where quota_id = '+invQu.FieldByName('quota_id').AsString;
StrSQL2 := 'Select * from quota_parts a, part b where a.part_id=b.part_id and quota_id = '+invQu.FieldByName('quota_id').AsString;
QuotaSelForm.QutoOrInvo(1);
end;
end; with QuotaSelForm.QuotaQu do
begin
Close;
SQL.Text:= StrSQL;
Open;
end; with QuotaSelForm.LabourQu do
begin
Close;
SQL.Text := StrSQL1;
Open;
end; with QuotaSelForm.PartsQu do
begin
Close;
SQL.Text := StrSQL2;
Open;
end;
QuotaSelForm.ShowModal;
end;procedure TQueryForm.ExitTBClick(Sender: TObject);
begin
Close;
end;procedure TQueryForm.PrintBTClick(Sender: TObject);
var StrSQL,StrSQL1,StrSQL2,QuotaID : String;
begin
case SearchPC.TabIndex of
0:
begin
QuotaID := ShowDBDbl.Fields[0].AsString;
StrSQL:='Select * from quotation a, client_table b,car_table c where '+
'a.client_id=b.client_id and b.client_id=c.client_id and a.quota_id= '+QuotaID;
StrSQL1 :='Select * from quota_labour where quota_id = '+QuotaID;
StrSQL2 := 'Select * from quota_parts a, part b where a.part_id=b.part_id and quota_id = '+QuotaID;
with QueryQu do
begin
Close;
SQL.Text := StrSQL;
Open;
end;
with LabourQu do
begin
Close;
SQL.Text := StrSQL1;
Open;
end; with PartsQu do
begin
Close;
SQL.Text := StrSQL2;
Open;
end;
QueryRVP.Active:=false;
QueryRVP.Active:=true;
QueryRVP.Execute;
end;
1:
begin
QuotaID:=InvoiceDB.Fields[0].AsString;
StrSQL:='Select * from quotation a,client_table b,car_table c ,inv_table d where '+
'a.client_id=b.client_id and b.client_id=c.client_id and a.quota_id=d.quota_id and a.quota_id = '+QuotaID; StrSQL1 :='Select * from quota_labour where quota_id = '+QuotaID;
StrSQL2 := 'Select * from quota_parts a, part b where a.part_id=b.part_id and quota_id = '+QuotaID;
with QueryQu do
begin
Close;
SQL.Text := StrSQL;
Open;
end;
with LabourQu do
begin
Close;
SQL.Text := StrSQL1;
Open;
end; with PartsQu do
begin
Close;
SQL.Text := StrSQL2;
Open;
end;
if InvoiceRVP.Assign then
InvoiceRVP.Execute;
end;
end;end;end.