那位大哥帮忙看看,错在那里了!! ( 积分: 50 )

  • 主题发起人 主题发起人 zhaofengtc
  • 开始时间 开始时间
Z

zhaofengtc

Unregistered / Unconfirmed
GUEST, unregistred user!
TTable *Table1=new TTable(Application);
Table1->DatabaseName="C://";
Table1->TableName="mb.db";
Table1->Active=true;
Table1->Open();
int i,j,n;
Application->ProcessMessages();
while(!Table1->Eof)
{


for(j=1;j<Table1->FieldCount;j++)
{
i=1;
WideString("F6Book1->TextRC[i,j]")=Table1->Fields->Fields[j]->FieldName;
if(j<22)
F6Book1->TextRC[i,j]=Table1->Fields[j];
if (j>23)
F6Book1->TextRC[i,j-2]=Table1->Fields[j];
i=i+1;
}

Table1->Next();
}

F6Book1->SaveFileDlg(WideString("bao").c_bstr(),WideString("c://").c_bstr(),11);
F6Book1->Write(WideString("c://").c_bstr(),11);
Table1->Close();
 
TTable *Table1=new TTable(Application);
Table1->DatabaseName="C://";
Table1->TableName="mb.db";
Table1->Active=true;
Table1->Open();
int i,j,n;
Application->ProcessMessages();
while(!Table1->Eof)
{


for(j=1;j<Table1->FieldCount;j++)
{
i=1;
WideString("F6Book1->TextRC[i,j]")=Table1->Fields->Fields[j]->FieldName;
if(j<22)
F6Book1->TextRC[i,j]=Table1->Fields[j];
if (j>23)
F6Book1->TextRC[i,j-2]=Table1->Fields[j];
i=i+1;
}

Table1->Next();
}

F6Book1->SaveFileDlg(WideString("bao").c_bstr(),WideString("c://").c_bstr(),11);
F6Book1->Write(WideString("c://").c_bstr(),11);
Table1->Close();
 
不知道出了什么问题,可以把编译错误贴上来,下面胡乱提点建议
Table1->Active=true;
Table1->Open();这里重复了
WideString("F6Book1->TextRC[i,j]")=Table1->Fields->Fields[j]->FieldName;
这句话没懂,是不是要反过来
F6Book1->TextRC[i,j]=(WideString)Table1->Fields->Fields[j]->FieldName;
这样?

for(j=1;j<Table1->FieldCount;j++)改成
for (j = 0 ;
j < Table1->FieldCount;
j++)看看
F6Book1->TextRC[i,j]=Table1->Fields[j];
不知道你要实现什么,如果是字段名就可以用
F6Book1->TextRC[i,j]=Table1->Fields[j]->FieldName;
如果是值
F6Book1->TextRC[i,j]=Table1->Fields[j]->AsString;
 
后退
顶部