数据库浏览器的一段代码
在头文件.h中
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;
//---------------------------------------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;}
不知道什么错,我从DELPHI翻译过来的
[解决办法]
Classes with properties cannot be copied by value
属性设置出错了,你看看是段代码的问题
Could not find a match for 'TSQLConnection::TSQLConnection()'
//__fastcall virtual TSQLConnection(Classes::TComponent* AOwner);
//TSQLConnection() 带个参数进去试试
[解决办法]
来过!~~