【发布时间】:2017-04-13 21:58:47
【问题描述】:
我有一个查询,使用像这样的 TSQLQuery
TSQLQuery* tq = new TSQLQuery(NULL);
tq->SQLConnection = atdbDM->SQLConnection1;
tq->SQL->Add("SELECT LAST_INSERT_ID();");
tq->Open();
int insert_id = tq->Fields->operator [](0)->AsInteger;
表达式
int insert_id = tq->Fields->operator [](0)->AsInteger;
相当笨重。看实现,operator[]在header中被重载了:
public:
TField* operator[](int Index) { return Fields[Index]; }
但是,如果我打电话:
int insert_id = tq->Fields[0]->AsInteger;
我得到编译器错误:
[bcc32 Error] TRegisterFreshCSBatchForm.cpp(97): E2288 Pointer to structure
required on left side of -> or ->*
TRegisterFreshCSBatchForm::mRegisterBtnClick(TObject *)
任何想法为什么上述调用不编译?我一定是错过了什么..
【问题讨论】:
标签: c++ c++builder vcl dbexpress