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
[47637] 동적으로 DB table 생성시 '숭'이라는 폴더에서는 테이블이 생성되지 않는 이유
배병철 [] 1025 읽음    2007-01-04 01:14
아래와 같이 동적으로 DB Table 생성 프로그램을 작성해서 실행하면
다른 폴더에서는 잘 작동하는데
'숭'이라는 단어가 들어있는 폴더에서 실행하면 데이블을 생성할 수 없다고 나오는데
왜 그렇죠?

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop
#include <BDE.hpp>
#include <DBTables.hpp>
#include "unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::CreateAlias()
{
    //TODO: Add your source code here
    //alias 생성
    try
    {
        String Alias = GetCurrentDir();
        hDBISes h;
        DbiInit(NULL);
        DbiStartSession("dummy", h, "");
        DbiAddAlias(NULL, "Data", "PARADOX", ("PATH:" + Alias).c_str(), true);
        DbiCloseSession(h);
        DbiExit;
    }
    catch (...)
    {
        MessageBox(Handle, "Error Creating Alias", "Error", 0);
        return;
    }
}

void __fastcall TForm1::DeleteAlias()
{
    //TODO: Add your source code here
    try   //alias 삭제
    {
        DbiDeleteAlias(NULL, "Data");
    }
    catch (...)
    {
        MessageBox(Handle, "Error Deleting Alias", "Error", 0);
        return;
    }
}
void __fastcall TForm1::ConnectDataTables()
{
    String Path = GetCurrentDir();
    ShowMessage(Path);
    String product = Path + "Product.db";
    if(!FileExists(product))
        CreatePodoProductTable();
}

void __fastcall TForm1::CreatePodoProductTable()
{
  //TODO: Add your source code here
    TTable *table;
    try
    {
        table = new TTable(this);

        table->DatabaseName = "Data";
        table->TableType = ttParadox ;
        table->TableName    = "Product.db";

        table->FieldDefs->Add("Number",   ftString,  19, false);
        table->FieldDefs->Add("CropDate",     ftString, 10, true);//출하일
        table->FieldDefs->Add("ShipmentPlace",ftString, 16, true);//출하지
        table->FieldDefs->Add("TreeKind",     ftString, 12, true);//품종
        table->FieldDefs->Add("BoxWeight",    ftString,  6, true);//상자 무게

        table->IndexDefs->Add("", "Number", TIndexOptions() << ixUnique << ixPrimary);

        table->CreateTable();
    }
    catch (...)
    {
        MessageBox(Handle, "Error Creating Tables", "Error", 0);
        delete table;
        return;
    }

    delete table;
}

void __fastcall TForm1::FormCreate(TObject *Sender)
{
    DeleteAlias();
    CreateAlias();
    ConnectDataTables();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::FormDestroy(TObject *Sender)
{
    DeleteAlias();
}
//---------------------------------------------------------------------------

+ -

관련 글 리스트
47637 동적으로 DB table 생성시 '숭'이라는 폴더에서는 테이블이 생성되지 않는 이유 배병철 1025 2007/01/04
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.