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
[10517] Re:[질문]TTable에서 테이블 삭제. DeleteTable과 생성 CreateTable 할때에 나오는 오류사항.
개박살.U&I [inutero] 1116 읽음    2001-09-01 16:45

안녕하세요? 개박살입니다.

됐다가 안되다가 하는건, 정확하게 이게 잘못됐다라고는 말씀드릴순 없구요 (저도 허접이라..)

다만, DeleteTable 했다가 다시생성할때,, 그냥 CreateTable로 한것이 이상하군요..

예제를 보시고 해보시는것이.. TTable의 CreateTable예제를 첨부합니다.


The following example shows how to create a table.

if (!Table1->Exists) // Don't overwrite an existing table
{
  Table1->Active = false; // The Table component must not be active

  // First, describe the type of table and give it a name
  Table1->DatabaseName = "BCDEMOS";
  Table1->TableType = ttParadox;

  Table1->TableName = "CustInfo";

  // Next, describe the fields in the table

  Table1->FieldDefs->Clear();
  TFieldDef *pNewDef = Table1->AddFieldDef();
  pNewDef->Name = "Field1";
  pNewDef->DataType = ftInteger;

  pNewDef->Required = true;

  pNewDef = Table1->AddFieldDef();

  pNewDef->Name = "Field2";
  pNewDef->DataType = ftString;

  pNewDef->Size = 30;

  // Next, describe any indexes

  Table1->IndexDefs->Clear();
  /* the 1st index has no name because it is a Paradox primary key */
  Table1->IndexDefs->Add("","Field1", TIndexOptions() <<ixPrimary << ixUnique);

  Table1->IndexDefs->Add("Fld2Index","Field2", TIndexOptions() << ixCaseInsensitive);

  // Now that we have specified what we want, create the table

  Table1->CreateTable();
}

보시면, 새로생성시에 필드정보까지 다시 생성하더군요..

delete는,

Table1->Active = false; // can뭪 delete table if it is active
// set properties to identify the table that should be deleted

Table1->DatabaseName = "BCDEMOS";
Table1->TableName = "Customer";

Table1->TableType = ttParadox;

// finally, delete the table

Table1->DeleteTable();

이거구요.. 예제를 한번 참고고해서 다시해보시죠??

그럼 허접-답변 죄송~~


김진철 님이 쓰신 글 :
: 제가 TTable로 테이블을 삭제했다가 생성해서 작업을 합니다.
:
: 제가 쓴 코드를 보여드리겠습니다.
:
: qryT->Close();
: tableT->Active = true;
: tableT->Active = false;
: tableT->DeleteTable();
: tableT->CreateTable();
: qryT->Open();
:
: 이것이 제가 쓰는 코드입니다. 위에 tableT->Active를 true 했다가 false하는 이유는..
: 이렇게 안하면 에러가 나서 입니다. 한번 활성화를 시켜 줬다가 비활성화 시킨후에
: 테이블 삭제, 생성이 되더라고요..
: 그런데 이렇게 하면.. 잘 될때가 있고. 안될때가 있습니다.
:
: 안될때는 T.DB 가 Busy 상태다. 라고 오류메세지가 뜹니다.
: 이게 규칙적으록 그러면 어떻게 해보겠지만..
: 불규칙적으로 일어나서 죽겠습니다.
:
: 제발. 답변 부탁드립니다.
:

+ -

관련 글 리스트
10516 [질문]TTable에서 테이블 삭제. DeleteTable과 생성 CreateTable 할때에 나오는 오류사항. 김진철 903 2001/09/01
10518     Re:[질문]TTable에서 테이블 삭제. DeleteTable과 생성 CreateTable 할때에 나오는 오류사항. 최보현.U&I 984 2001/09/01
10525         Re:Re:[질문]TTable에서 테이블 삭제. DeleteTable과 생성 CreateTable 할때에 나오는 오류사항. 김진철 1033 2001/09/01
10517     Re:[질문]TTable에서 테이블 삭제. DeleteTable과 생성 CreateTable 할때에 나오는 오류사항. 개박살.U&I 1116 2001/09/01
10523         Re:Re:[질문]TTable에서 테이블 삭제. DeleteTable과 생성 CreateTable 할때에 나오는 오류사항. 김진철 1183 2001/09/01
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.