C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[24531] ADOQuery->Close()시에 에러가발생하는데요...
하니 [] 885 읽음    2003-02-27 16:51
ADOQuery->Close()시에 에러가 나거든요???

먼저 소스는.. 다음과 같거든요???


    try{
        if(ADOCon->Connected == false)
            ADOCon->Open();
    }catch(Exception& e){

        SetMsgBox("ADO Open : " + e.Message, "에러");
        return;
    }

    AnsiString strSQL;
    AnsiString strSQLTot;

    strSQLTot = "SELECT * FROM bb GROUP BY GUBUN";

    TStringList *TempListTot = new TStringList; // declare the list
    String strFormulaTot;
    TVarRec vTot[] = {strSQLTot};
    strFormulaTot = Format("%s", vTot, ARRAYSIZE(vTot)-1);
    TempListTot->Add(strFormulaTot);//add a string to the list



    strSQL += "SELECT * from aaa";


    TStringList *TempList = new TStringList; // declare the list
    String strFormula;
    TVarRec v[] = {strSQL};
    strFormula = Format("%s", v, ARRAYSIZE(v)-1);
    TempList->Add(strFormula);//add a string to the list

    //ShowMessage(strFormula);

    TCursor Save_Cursor = Screen->Cursor;
    Screen->Cursor = crHourGlass;    // Show hourglass cursor
    pnlSelect->Visible = true;
    try
    {


        //ADOQueryTot
        ADOQuery1->Connection = ADOCon;
        ADOQuery1->Close();
        ADOQuery1->SQL->Clear();
        ADOQuery1->SQL = TempListTot;
        ADOQuery1->CursorLocation = clUseClient;
        ADOQuery1->CursorType = ctStatic;
        ADOQuery1->Open();

        if(ADOQuery1->RecordCount > 0){
            lblFine3->Caption       = ADOQuery1->Fields->Fields[0]->AsString;
            lblOutOfOrder3->Caption = ADOQuery1->Fields->Fields[1]->AsString;
            lblTotal3->Caption      = ADOQuery1->Fields->Fields[2]->AsString;

        }else{
            lblFine3->Caption = "0";
            lblOutOfOrder3->Caption = "0";
            lblTotal3->Caption = "0";
        }
        ADOQuery1->Close();




        //ADOQuery
        ADOQuery2->Connection = ADOCon;
        ADOQuery2->Close();
        ADOQuery2->SQL->Clear();
        ADOQuery2->SQL = TempList;
        ADOQuery2->CursorLocation = clUseClient;
        ADOQuery2->CursorType = ctStatic;
        ADOQuery2->Open();

        QuickRep3->Prepare();
        totLabel3->Caption = QuickRep3->QRPrinter->PageCount;
        QuickRep3->QRPrinter->Free();
        QuickRep3->QRPrinter = NULL;

        QuickRep3->Zoom = 80;

    }
    __finally
    {
        Screen->Cursor = Save_Cursor; // always restore the cursor
        pnlSelect->Visible = false;
    }

    try{
        QuickRep3->Preview();
    }
    __finally
    {
            ADOQuery2->Close();
            delete TempList;
            delete TempListTot;
    }

이게 원본 소스인데요... 마지막에 ADOQuery2->Close(); 부분에서 다음의 에러가 발생합니다...
BOF 또는 EOF 가 참이거나 ,현재레코드를 삭제했습니다.요청한 작업에 현재레코드가 필요합니다.
라는 메세지가 나타납니다...
원인을 모르겠거든요??
아시는 분 알려주십시요..
그럼 부탁드립니다

+ -

관련 글 리스트
24531 ADOQuery->Close()시에 에러가발생하는데요... 하니 885 2003/02/27
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.