麻烦大家帮看下
//delphi中procedure TDynamicSQLDemoServer.GetAllTables(var vTables:OleVariant);var tbllist : TStringList; iCount : Integer;begin try tbllist := TStringList.Create; ADOConnection1.GetTableNames(tbllist); vTables := VarArrayCreate([0,tbllist.Count-1],varVariant); for iCount :=0 to tbllist.Count-1 do begin vTables[iCount]=tbllist[iCount]; end; finally tbllist.Free; end; end
void __fastcall TDynamicSQLDemoServer::GetAllTables(Variant vTables){ TStringList *tbllist = new TStringList; try { ADOConnection1->GetTableNames(tbllist); int n[2] = { 0, tbllist->Count - 1 }; vTables = VarArrayCreate(n, 1, varVariant); for (int iCount = 0; iCount < tbllist->Count; iCount++) { vTables.PutElement(tbllist->Strings[iCount], iCount); } } __finally { delete tbllist; }}
[解决办法]
就是获取列表名,给你段代码参考
TStringList *slt=new TStringList;
ADOConnection1->GetTableNames(slt,false);
for(int i=0;i<slt->Count;i++)
{
ShowMessage(slt->Strings[i]);
}
delete slt;