|
안녕하십니까...저에게 심각한 오류가 발생했습니다..........
TEdit *PartEdit[7][10];
for (int i=0; i < 7; i++) {
for (int j=0; j < 10; j++)
{
PartEdit[i][j] = new TEdit(this);
PartEdit[i][j]->Parent = Part_View;
PartEdit[i][j]->Left = 50+ j*96;
PartEdit[i][j]->Top = 190 + i*76;
PartEdit[i][j]->Width = 95;
}
}
우선은 이렇게 Edit컴포넌트를 동적으로 생성했습니다.그리고 텍스트 박스에 데이타 베이스에서 값을 받아서
뿌리기 위해 아래와 같이 코드 했습니다.
void __fastcall ReadRentDayData(char Step) //제가 정의한 함수임니다...
{
int k = 0;
CustomerData->Part1Query->Active = false;
CustomerData->Part1Query->SQL->Clear();
switch (Step) {
case 'A':
CustomerData->Part1Query->SQL->Add("Select 출고날짜 from 분점A Where ID = :ID And 조번호 = :조번호");
break;
case 'B':
CustomerData->Part1Query->SQL->Add("Select 출고날짜 from 분점B Where ID = :ID And 조번호 = :조번호");
break;
}
CustomerData->Part1Query->ParamByName("ID")->AsString = "'" + CustomerData->PartTable->FieldByName("ID")->AsString + "'";
for (int i=0; i < 7; i++) {
//EditBox에 70 개에 내용을 뿌림.....
for (int j=0; j < 10; j++)
{
k++;
CustomerData->Part1Query->ParamByName("ID")->AsString = "'" + CustomerData->PartTable->FieldByName("ID")->AsString + "'";
//PartTable의 ID의 값을 그대로 파라메타에 집어넣는다...
CustomerData->Part1Query->ParamByName("조번호")->AsString = k;
//조번호의 값이 k인 값의 레코드를 찾아서 출고날짜를 뿌린다.
//"ID"의 Type = 텍스트 , "조번호"의 Type = 숫자 , "출고날짜"의 Type = 텍스트
CustomerData->Part1Query->Prepare();
if(CustomerData->Part1Query->Prepared) CustomerData->Part1Query->ExecSQL();
CustomerData->Part1Query->Active = true;
PartEdit[i][j]->Text = CustomerData->Part1Query->FieldByName("출고날짜")->AsString;
}
}
}
void __fastcall TPart_View::PartComboChange(TObject *Sender)
{
switch (PartCombo->ItemIndex) {
case 0:
ReadRentDayData('A');
break;
case 1:
ReadRentDayData('B');
break;
}
}
.................근데 이렇게 코드를짯는데..............이부분에서 에러가
Part1Query : Cannot perform this operation an open dataset.......
뭐가 잘못된거죠????? 쿼리문을 루프돌릴때 잘못한게 있나여???ㅜ.ㅜ
도움말 부탁드립니다.
|