如何使用SDI MFC创建数据库 [英] How to create database using SDI MFC

查看:46
本文介绍了如何使用SDI MFC创建数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目来创建一个可以使用SDI MFC创建数据库的应用程序。

我的应用程序可以创建一个新的数据库并将其存储在* .db文件中,并且应用程序也可以可以创建一个表,我必须将表存储在* .td和* .tdf文件中。

所以任何人都可以帮助我如何开始这样做?

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?

推荐答案

// 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>





我有一个从SDI MFC弹出窗口,而我试图做的是当我单击OK时,它会生成一个.db文件,但当我在文件夹内检查时,文件不在那里。如何生成a.db文件?



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?


这篇关于如何使用SDI MFC创建数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆