0
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;
같이 진행 TSQLQuery을 사용하여 질의가 꽤 투박. 내가 호출하는 경우,
public:
TField* operator[](int Index) { return Fields[Index]; }
그러나 : 구현을 보면, 운영자는 [] 헤더에 오버로드
[bcc32 Error] TRegisterFreshCSBatchForm.cpp(97): E2288 Pointer to structure
required on left side of -> or ->*
TRegisterFreshCSBatchForm::mRegisterBtnClick(TObject *)
어떤 아이디어 :
int insert_id = tq->Fields[0]->AsInteger;
내가 컴파일러 오류 위의 호출이 컴파일되지 않는 이유는 무엇입니까 ?? 내가 모르는 뭔가가 있어야합니다 ..
는
을 대안은 단순히을하다 'TFields :: operator []'를 사용하지 말고'TFields :: Fields []'속성을 직접 사용하십시오 :'int insert_id = tq-> Fields-> Fields [0] -> AsInteger;'TFields :: : operator []'는 여분의'CALL' 명령을 제외하고는 아무 것도 얻지 못합니다. C++에 존재하는 유일한 이유는'default' 속성에 액세스 할 때 Delphi 구문에 더 가까운 C++ 구문을 제공하는 것입니다. –