Showing posts with label Access. Show all posts
Showing posts with label Access. Show all posts

2008/03/11

Turbo C++ 동적 MDB (Access Database) 생성하기

// For Create MDB
#include <odbcinst.h>
#pragma link "Odbccp32.lib"



strMainDBPath = "CREATE_DB=\"" + strMainDBPath + "\" General\0";

bool bCreated;
bCreated = SQLConfigDataSource(
NULL,
ODBC_ADD_DSN,
"Microsoft Access Driver (*.mdb)",
strMainDBPath.c_str() );

if (bCreated == true)
{
ShowMessage("Created!!");
}
else
{
ShowMessage("Fail to create database");
}

Original Post : http://neodreamer-dev.tistory.com/83

2008/01/13

동적 MDB 생성하기

동적으로 MS Access DB를 만드는 코드.


// For Create MDB
#include <odbcinst.h>
#pragma link "Odbccp32.lib"


int __fastcall TDM::CreateMainDB()
{
AnsiString strMainDBPath;
strMainDBPath = m_strPath + "\MainDB.MDB";

if (FileExists(strMainDBPath))
{
ShowMessage("MainDB is Exists already!");
return -1;
}

strMainDBPath = "CREATE_DB=\"" + strMainDBPath

+ "\" General\0";

bool bCreated;
bCreated = SQLConfigDataSource(
NULL,
ODBC_ADD_DSN,
"Microsoft Access Driver (*.mdb)",
strMainDBPath.c_str() );

if (bCreated == true)
{
return 0;
}
else
return -2;
}


Original Post : http://neodreamer-dev.tistory.com/33