数据库浏览器的一段代码

ooip1919 2009-06-18 12:59:14
在头文件.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;

在.cpp中

//---------------------------------------------------------------------------
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翻译过来的

...全文
63 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
ooip1919 2009-06-25
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 zhouzhangkui 的回复:]
Classes with properties cannot be copied by value
属性设置出错了,你看看是段代码的问题

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

不是这样滴,嘿嘿,不过已经解决了.
binghe2007 2009-06-18
  • 打赏
  • 举报
回复
来过!~~
周药师 2009-06-18
  • 打赏
  • 举报
回复
Classes with properties cannot be copied by value
属性设置出错了,你看看是段代码的问题

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

1,178

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder 数据库及相关技术
社区管理员
  • 数据库及相关技术社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧