求教 2010mfc基于对话框如何连接access数据库及如何运用数据编程及后期的美化??

即将毕业的学生这方面太差,希望能给与帮助,谢谢!!!
1.熟悉输油站的结构及常见的输油、混油工艺;
2. 了解泵站所用输油泵的类型,对泵的运行方式及运行特征进行重点学习,并予以总结和综述;
3. 了解已有泵优化运行的方法,根据输油泵的特征,有针对性的选择1~2种优化运行的数学模型和求解方法;
4. 至少掌握一种面向对象的编程语言(c++或Delphi),并用其实现对所确定的输油泵优化的数学模型求解;
5. 通过一个实际的泵站优化对数学模型及求解方法予以验证;

 #include <afxwin.h> 
#include <afxdtctl.h>                                   // Internet Explorer 4 公共控件的 MFC 支持
#include<iostream>

#import "c:Program FilesCommon FilesSystemadomsado15.dll" no_namespace rename("EOF","rsEOF")

using namespace std;

int main()
{

_ConnectionPtr    m_pConn;                    //声明数据库Connection智能指针

_RecordsetPtr    m_pRst;                         //声明数据库Recordset智能指针

CString m_username;
int m_age;
bool m_single;



CoInitialize(NULL);                                    //初始化com

m_pConn.CreateInstance(__uuidof(Connection));    
m_pRst.CreateInstance(__uuidof(Recordset));    

m_pConn->CursorLocation = adUseClient;    //设置游标类型

m_pConn->Open(
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=user.mdb","","",adModeUnknown);

////////////////////////////////////////////////////////////////////////////////

//将内容写入数据库tblLaneLoginLog

    HRESULT hr;
    CString name = "linux";
    int age = 25;
    _variant_t   IsSingle;     
    IsSingle.boolVal=false;

    hr =    m_pRst->Open("select * from tblUserInfo",
                m_pConn.GetInterfacePtr(),
                adOpenDynamic,
                adLockOptimistic,
                adCmdText);

    if(hr == S_OK)
    {
        m_pRst->AddNew();
        m_pRst->PutCollect("UserName",(_variant_t)"linux");        //添加字符型数据
        m_pRst->PutCollect("Age",(_variant_t)(long(age)));            //添加整型
        m_pRst->PutCollect("Single",IsSingle.boolVal);                  //添加布尔型

        m_pRst->Update();
        m_pRst->Close();
    }

////////////////////////////////////////////////////////////////////////////////

//读取数据库内容    


//打开数据库表tblUserInfo



hr =    m_pRst->Open("select * from tblUserInfo",
        m_pConn.GetInterfacePtr(),
        adOpenDynamic,
        adLockOptimistic,
        adCmdText);

//从第一条记录开始读取数据库表

if(hr == S_OK)
{
    while(!m_pRst->rsEOF)
    {
        m_username = m_pRst->GetCollect("UserName");
        m_age = m_pRst->GetCollect("Age");
        m_single = m_pRst->GetCollect("Single");
        m_pRst->MoveNext();
        cout << "用户名: " << m_username << " 年龄: " << m_age << " 是否结婚: " << m_single << endl;
    }

        m_pRst->Close();                                    //关闭RecordSet
}

m_pRst.Release();                                         //减少引用计数

m_pConn->Close();                                       //关闭连接

m_pConn.Release();    

system("pause");
return 0;

////////////////////////////////////////////////////////////////////////////////

}