问题描述
我已经按照以下描述完成了:
I have done this as described below:
现在我收到以下错误:
[Fehler] Unit1.pas(1650): Inkompatible Typen: 'ADODB_TLB.TStream' und 'Classes.TStream'
[Fehler] Unit1.pas(1651): Inkompatible Typen: 'ADODB_TLB.TStream' und 'Classes.TStream'
[Fehler] Unit1.pas(1655): Inkompatible Typen: 'Classes.TStream' und 'ADODB_TLB.TStream'
[Fehler] Unit1.pas(1656): Inkompatible Typen: 'Classes.TStream' und 'ADODB_TLB.TStream'
[Fehler] Unit1.pas(1720): Inkompatible Typen: 'ADODB_TLB.TStream' und 'Classes.TStream'
[Fehler] Unit1.pas(1724): Inkompatible Typen: 'Classes.TStream' und 'ADODB_TLB.TStream'
在此语句中:
SpecStream := MyQuery9.CreateBlobStream(MyQuery9.FieldByName('SpecSheet'), bmRead);
SaftyStream := MyQuery9.CreateBlobStream(MyQuery9.FieldByName('SaftySheet'), bmRead);
我知道我通过导入TLB来更改类型库。
但是我如何仍然可以使用这两个类?
I know that I have change the Type library by importing the TLBs.But How can I still use both Classes?
这是我的代码,那只是必需的部分:
//我们犯错误。)
Here is my code, that part that is necessary only:(The lines commended out with //we makes an error.)
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, Grids, DBGrids, ExtCtrls, DBCtrls, MemDS, DBAccess,
MyAccess, MyDacVcl, StdCtrls, frxClass, frxDesgn, frxDBSet, frxExportPDF,
jpeg, ComCtrls, SBCookieMgr, SBSimpleSSL, SBHTTPSClient, SBConstants,
SBHTTPCRL, SBHTTPOCSPClient, SBHTTPCertRetriever, SBX509,
SBSSLClient, SBTypes, SBUtils, SBCustomCertStorage, SBCertValidator,
OleCtrls, SHDocVw ,Wininet, PDFSplitMerge_TLB,
ActiveX, // IMalloc
ShlObj, SBArcBase, SBArcZip, // CSIDL_-Konstanten
ShellAPI; // SHGetSpecialFolderLocation() und SHGetPathFromIDList()
type
...
implementation
{$R *.dfm}
uses RegExpr, CDO_TLB, ADODB_TLB;
..
procedure TForm1.Button7Click(Sender: TObject);
var
oldTabSheet: TTAbSheet;
SpecStream, SaftyStream: TStream;
MyAN: string;
MyLief: String;
begin
oldTabSheet := pageControl1.ActivePage;
pageControl1.ActivePage:= TabSheet5;
//WebBrowser1.Navigate(PrgDirName+'\laborbedarf.pdf');
//WebBrowser1.Quit;
//Radiobutton1.Checked:=NOT(radiobutton1.Checked);
//Radiobutton2.Checked:=NOT(radiobutton2.Checked);
MyAN := MyQuery1.FieldByName('ArtikelNummer').AsString;
MyLIEF := MyQuery1.FieldByName('Lieferant').AsString;
if NOT((MyAN = NULL) or (MyAN = '')) then
begin
(* ---------------------------------------------------------- LIEFERANT 1 ---*)
if MyLIEF = DBGrid1.Columns[11].PickList[0] then
begin
MyQuery9.SQL.Text:='select * from stoff WHERE RecID = :Old_RecID';
MyQuery9.ParamByName('Old_RecID').AsInteger := MyQuery1.FieldByName('RecID').AsInteger;
MyQuery9.Execute;
//we SpecStream := MyQuery9.CreateBlobStream(MyQuery9.FieldByName('SpecSheet'), bmRead);
//we SaftyStream := MyQuery9.CreateBlobStream(MyQuery9.FieldByName('SaftySheet'), bmRead);
MyStream2S := TMemoryStream.Create;
MyStream3S := TMemoryStream.Create;
MyStream2S.Clear; MyStream3S.clear;
//we MyStream2S.LoadFromStream(SaftyStream );
//we MyStream3S.LoadFromStream(SpecStream );
if RadioButton1.Checked then
begin
try
DeleteFile(GetTempDirectory+'Sicherheitsdatenblatt_tmp.pdf');
MyStream2S.SaveToFile(GetTempDirectory+'Sicherheitsdatenblatt_tmp.pdf');
WebBrowser1.Navigate(GetTempDirectory+'Sicherheitsdatenblatt_tmp.pdf');
Radiobutton1.Checked:= false;
Radiobutton2.Checked:= true;
except
end;
try
DeleteFile(GetTempDirectory+'Spezifikation_tmp.pdf');
MyStream3S.SaveToFile(GetTempDirectory+'Spezifikation_tmp.pdf');
WebBrowser1.Navigate(GetTempDirectory+'Spezifikation_tmp.pdf');
Radiobutton1.Checked:= true;
Radiobutton2.Checked:= false;
except
end;
end
else if RadioButton2.Checked then
begin
try
DeleteFile(GetTempDirectory+'Spezifikation_tmp.pdf');
MyStream3S.SaveToFile(GetTempDirectory+'Spezifikation_tmp.pdf');
WebBrowser1.Navigate(GetTempDirectory+'Spezifikation_tmp.pdf');
Radiobutton1.Checked:= true;
Radiobutton2.Checked:= false;
except
end;
try
DeleteFile(GetTempDirectory+'Sicherheitsdatenblatt_tmp.pdf');
MyStream2S.SaveToFile(GetTempDirectory+'Sicherheitsdatenblatt_tmp.pdf');
WebBrowser1.Navigate(GetTempDirectory+'Sicherheitsdatenblatt_tmp.pdf');
Radiobutton1.Checked:= false;
Radiobutton2.Checked:= true;
except
end;
end;
end
(* ---------------------------------------------------------- LIEFERANT 2 ---*)
else
if MyLIEF = DBGrid1.Columns[11].PickList[1] then
begin
MyQuery9.SQL.Text:='select * from stoff WHERE RecID = :Old_RecID';
MyQuery9.ParamByName('Old_RecID').AsInteger := MyQuery1.FieldByName('RecID').AsInteger;
MyQuery9.Execute;
//SpecStream := MyQuery9.CreateBlobStream(MyQuery9.FieldByName('SpecSheet'), bmRead);
//we SaftyStream := MyQuery9.CreateBlobStream(MyQuery9.FieldByName('SaftySheet'), bmRead);
MyStream2S := TMemoryStream.Create;
MyStream3S := TMemoryStream.Create;
MyStream2S.Clear; MyStream3S.clear;
//we MyStream2S.LoadFromStream(SaftyStream );
//MyStream3S.LoadFromStream(SpecStream );
Radiobutton1.Checked:= false;
Radiobutton2.Checked:= true;
if RadioButton2.Checked then
begin
try
DeleteFile(GetTempDirectory+'Spezifikation_tmp.pdf');
MyStream3S.SaveToFile(GetTempDirectory+'Spezifikation_tmp.pdf');
if Filesize(GetTempDirectory+'Spezifikation_tmp.pdf') > 5 then
WebBrowser1.Navigate(GetTempDirectory+'Spezifikation_tmp.pdf')
else
WebBrowser1.Navigate(PrgDirName+'\PDFLeer.pdf');
Radiobutton1.Checked:= true;
Radiobutton2.Checked:= false;
except
ShowMessage(' Kann PDF nicht anzeigen, wurde es nicht geladen weil nicht verfügbar?');
end;
try
DeleteFile(GetTempDirectory+'Sicherheitsdatenblatt_tmp.pdf');
MyStream2S.SaveToFile(GetTempDirectory+'Sicherheitsdatenblatt_tmp.pdf');
if Filesize(GetTempDirectory+'Sicherheitsdatenblatt_tmp.pdf') > 5 then
WebBrowser1.Navigate(GetTempDirectory+'Sicherheitsdatenblatt_tmp.pdf')
else
WebBrowser1.Navigate(PrgDirName+'\PDFLeer.pdf');
Radiobutton1.Checked:= false;
Radiobutton2.Checked:= true;
except
ShowMessage(' Kann PDF nicht anzeigen, wurde es nicht geladen weil nicht verfügbar?');
end;
end;
end ;
//MyQuery1.Next;
MyStream3S.Clear;
MyStream2S.Clear;
MyStream3S.free;
MyStream2S.free;
end
else
begin
ShowMessage('Kein PDF in DB gefunden!');
end;
end;
推荐答案
显然你有第二个声明
,同时使用 ADODB_TLB
单位中的TStream ADODB_TLB
和类
在同一单位 - TStream
将被使用从最后一个单位它被声明。您可以解决这个问题:
Obviously you have second declaration of TStream
in ADODB_TLB
unit, and when you use both ADODB_TLB
and Classes
in same unit - TStream
will be used from last unit it is declared. You can resolve this:
-
通过明确使用
TStream
。
var
S1:ADODB_TLB.TStream; / code>
S2:Classes.TStream;
通过将一个 TStream
重命名为更独特的东西,如
ADODB_TLB.TStream
至 ADODB_TLB .TADOStream
。我更喜欢这个
的方式。您可以通过重新导入 ADODB_TLB
并指定code重命名为 TStream
(在导入向导中选择此项) )
By renaming one TStream
to something more unique likeADODB_TLB.TStream
to ADODB_TLB.TADOStream
. I would prefer thisway. You can do this by reimporting ADODB_TLB
and specify typerenaming for TStream
(this is selected in import wizard)
这篇关于Delphi 7中不兼容的类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!