Click here to Skip to main content
15,881,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I have a project to create an application that can create a database using SDI MFC.
My application can create a new database and store it in a *.db file and the application also can create a table and I must store the table in a *.td and *.tdf file.
So anyone can help me how can I start to do it?
Posted
Comments
Rage 28-Apr-14 6:09am    
What have you done already ? What does not work ?

1 solution

C++
// CreateDatabase.cpp : implementation file
//

#include "stdafx.h"
#include "RKDBMS.h"
#include "CreateDatabase.h"
#include "afxdialogex.h"
#include <iostream>
#include <fstream>
using namespace std;

// CCreateDatabase dialog

IMPLEMENT_DYNAMIC(CCreateDatabase, CDialog)

CCreateDatabase::CCreateDatabase(CWnd* pParent /*=NULL*/)
	: CDialog(CCreateDatabase::IDD, pParent)
{

}

CCreateDatabase::~CCreateDatabase()
{
}

void CCreateDatabase::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
}
// CCreateDatabase message handlers


BEGIN_MESSAGE_MAP(CCreateDatabase, CDialog)
	ON_BN_CLICKED(IDOK, &CCreateDatabase::OnBnClickedOk)
END_MESSAGE_MAP()




void CCreateDatabase::OnBnClickedOk()
{
	// TODO: Add your control notification handler code here
	CDialog::OnOK();
	CString cs1;
	GetDlgItemText(IDC_EDIT1, cs1);
	string fspec =  cs1 +".db";
	 ofstream myfile (fspec.c_str(), ios::out);
	
}
</fstream></iostream>


Well I have a pop up window from the SDI MFC and and what I tried to do is when I click OK, it will generate a.db file but when I check inside the folder the file is not there. How can I generate a a.db file?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900