|
소스코드를 잘 보았습니다.
이 소스 코드는 디비를 생성할때마다 데이타베이스 및 필드를 정의 해줘야 하네요..
제가 한 방법은.. 필드는... 이미.. tableT 콤포넌트에 정의되어 있습니다.
그리도 DatabaseName 은 쓰질 않습니다.. 서본적이 없습니다.
그냥 로컬에서 작업하는것이라서...
아뭏튼. 답변 정말 감사드리고요..
님께서 주신 소스 참고해서 해보고 나서.. 몇일 테스트한 후에 결과를 알려드리겠습니다.
정말 감사합니다.
개박살.U&I 님이 쓰신 글 :
:
: 안녕하세요? 개박살입니다.
:
: 됐다가 안되다가 하는건, 정확하게 이게 잘못됐다라고는 말씀드릴순 없구요 (저도 허접이라..)
:
: 다만, 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 상태다. 라고 오류메세지가 뜹니다.
: : 이게 규칙적으록 그러면 어떻게 해보겠지만..
: : 불규칙적으로 일어나서 죽겠습니다.
: :
: : 제발. 답변 부탁드립니다.
: :
|