首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ Builder >

数据库浏览器的一段代码,该如何解决

2012-03-03 
数据库浏览器的一段代码在头文件.h中C/C++ codetypedefunion{boolSupportsProceduresboolSupportsViewsb

数据库浏览器的一段代码
在头文件.h中

C/C++ code
typedef   union{   bool    SupportsProcedures;   bool    SupportsViews;   bool    SupportsSynonyms;   bool    SupportsSysTables;   bool    SupportsADTs;   bool    SupportsArrays;   bool    CheckConnection;  }TDriverInfo,*PDriverInfo;bool __fastcall GetDriverInfo(String Driver,TDriverInfo Info);private:    // User declarations        int ConnectionCount;

在.cpp中
C/C++ code
//---------------------------------------const String SProcedures="Procedures";const String SViews="Views";const String SSynonyms="Synonyms";const String SSysTables ="System Tables";const String SCheckConnectionKey ="CheckConnection";const String SADTS="ADTS";const String SArrays = "ARRAYS";const String SGETARRAYS ="GETARRAYS";const String SExplorerIni ="..\\dbxexpl.ini" ;//---------------------------------------bool __fastcall TForm2::GetDriverInfo(String Driver,TDriverInfo Info){   TMemIniFile  *Ini;  bool Result=true;   AnsiString   FilePath=ExtractFilePath(Application->ExeName);  try  { Ini=new TMemIniFile(FilePath+"dbxexpl.ini");    if(UpperCase(Ini->ReadString(Driver,SProcedures,"False"))== "TRUE" )      Info.SupportsProcedures = true;    if(UpperCase(Ini->ReadString(Driver, SViews,"False"))== "TRUE" )      Info.SupportsViews = true;    if (UpperCase(Ini->ReadString(Driver, SSynonyms,"False"))== "TRUE" )      Info.SupportsSynonyms = true;    if (UpperCase(Ini->ReadString(Driver, SSysTables,"False"))== "TRUE" )      Info.SupportsSysTables = true;    if (UpperCase(Ini->ReadString(Driver, SCheckConnectionKey,""))!="")      Info.CheckConnection = true;    if (UpperCase(Ini->ReadString(Driver, SADTS,"False"))== "TRUE" )      if (Ini->ReadString(Driver,"GetADTS","")!="")        Info.SupportsADTs = true;    if (UpperCase(Ini->ReadString(Driver, SArrays,"False"))== "TRUE" )      if(Ini->ReadString(Driver, SGETARRAYS, "")!="")        Info.SupportsArrays = true;   }  __finally {delete Ini;  } return Result;}//---------------------------------------void __fastcall TForm2::FormCreate(TObject *Sender){  DynamicArray <PDriverInfo>  DriverInfo;   DynamicArray <TSQLConnection>  Connections; int I, J; //SetDBControlsVisible(false);  ConnectionCount= 0; TStringList *DriverList=new TStringList(); TStringList *ConnectionList= new TStringList();      GetDriverNames(DriverList);     DriverInfo.Length= DriverList->Count;      for (I = 0;I<DriverList->Count;I++)     {        GetDriverInfo(DriverList->Strings[I],*DriverInfo[I]);    TreeView1->Items->AddChildObject(TreeView1->Items->Item[0],DriverList->Strings[I],DriverInfo[I]);        GetConnectionNames(ConnectionList,DriverList->Strings[I],false);        for( J = 0;J<ConnectionList->Count;J++)    {          Connections.Length=ConnectionCount+1 ;         // Connections[ConnectionCount] =new TSQLConnection(Self);             TreeView1->Items->AddChildObject(TreeView1->Items->Item[0]->GetLastChild(),                                              ConnectionList->Strings[J],Connections[I]);          ConnectionCount++;        }     }   delete DriverList;   delete ConnectionList;  Memo1->Visible = false;  SpeedButton1->Visible = false;}

[BCC32 Error] sysdyn.h(285): E2328 Classes with properties cannot be copied by value
[BCC32 Error] sysdyn.h(347): E2285 Could not find a match for 'TSQLConnection::TSQLConnection()'



不知道什么错,我从DELPHI翻译过来的



[解决办法]
Classes with properties cannot be copied by value 
属性设置出错了,你看看是段代码的问题

Could not find a match for 'TSQLConnection::TSQLConnection()'
//__fastcall virtual TSQLConnection(Classes::TComponent* AOwner);
//TSQLConnection() 带个参数进去试试

[解决办法]
来过!~~

热点排行