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
[17636] Re:[질문]DB 생성에서.....index 키...
허재연 [hurjiwoo] 949 읽음    2002-04-16 13:23
: 프로그램 내에서 DB를 만들때 인덱스 키를 어떻게 지정해요?

헬프의 내용을 붙여 넣기 한것입니다.
(Table1->CreateTable(); 의 헬프)

아래보시면 Table1->IndexDefs->Add(...)
도움이 될듯 합니다.

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();
}

+ -

관련 글 리스트
17626 [질문]DB 생성에서.....index 키... 볼랜드 주의자 801 2002/04/16
17636     Re:[질문]DB 생성에서.....index 키... 허재연 949 2002/04/16
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.