|
다음과 같이 하면 되는군요...
빌더 하면서 자료가 너무 없는듯 합니다.
예제도 많지도 않고, 사용하는 사람도, 책도 없고..
초보에겐 너무 배우기 힘드네요......
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TIBDatabase *IBDatabase1 = new TIBDatabase(this);
IBDatabase1->DatabaseName = "c:\\temp\\test.gdb";
IBDatabase1->Params->Clear();
IBDatabase1->Params->Append("USER 'SYSDBA'");
IBDatabase1->Params->Append("PASSWORD 'masterkey'");
IBDatabase1->Params->Append("PAGE_SIZE 4096");
IBDatabase1->LoginPrompt = false;
IBDatabase1->CreateDatabase();
delete IBDatabase1;
}
뽀뽀중 님이 쓰신 글 :
: InterBase를 이용하여 동적으로 DB화일을 생성하려 합니다.
:
: 방법을 몰라서 도움말 화일을 보니 다음과 같습니다.
:
: TIBDatabase.CreateDatabase
: Creates a database using Params.
:
: procedure CreateDatabase;
:
: Description
:
: Call CreateDatabase to create a database using Params as the rest of the CREATE DATABASE command.
: For example, if you wanted to create a local InterBase database, you could do the following:
:
: 1. Set the database name to the drive, path, and filename of the database file.
: 2. Set Params to the parameter for the CREATE DATABASE statement:
: USER "SYSDBA"
: PASSWORD "masterkey"
: PAGE_SIZE 4096
: 3. Set the SQLDialect value.
: 4. Call the CreateDatabase method.
:
: DB화일명과 패스를 정해주고 Params 를 이용해서 CREATE DATABASE 명령문을 사용해 DB화일을 생성하라고 하는것 같은데....
:
:
: 제가 작성한 코드는 아래와 같습니다.
: void TMainForm::CreateIDB()
: {
: AnsiString SQLstmt,Path,ProjectFileName;
: TParams *stmtParams= new TParams;
:
: Path=MainForm->ProjectPath;
: ProjectFileName=MainForm->ProjectFileName;
:
: try
: {
: IBMainDatabase->Connected=true;
: SQLstmt= "CREATE DATABASE "+ Path+ProjectFileName+ "USER 'SYSDBA' PASSWORD 'masterkey'";
: IBMainDatabase->CreateDatabase(SQLstmt,NULL,NULL,NULL);
: }
:
: catch (...)
: {
: delete stmtParams;
: }
:
: }
:
: 에러 메세지는
: [C++ Error] Main.cpp(187): E2227 Extra parameter in call to _fastcall TIBDatabase::CreateDatabase()
: 입니다.
:
: 아마도 CreateDatabase의 변수 입력이 잘못된듯한데,,,, 지적 부탁 드립니다.
:
|