数据库开发的初始化设置

王朝other·作者佚名  2006-11-24
窄屏简体版  字體: |||超大  

BOOL CStuApp::InitInstance()

{

AfxEnableControlContainer();

AfxOleInit();

m_pConnection.CreateInstance("ADODB.Connection");///创建Connection对象

m_pConnection->ConnectionTimeout=3;///设置超时时间为3秒

m_pConnection->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db1.mdb;","","",adModeUnknown);//连接数据库

SetDialogBkColor(RGB(0,81,162),RGB(0,255,0));设置对话框的背景色和当前色。

..........

BOOL CStuDlg::OnInitDialog()

{

CDialog::OnInitDialog();

// Add "About..." menu item to system menu.

DWORD dwStyle=::GetWindowLong(m_MyList.m_hWnd,GWL_STYLE);

//设置为报表形式

SetWindowLong(m_MyList.m_hWnd,GWL_STYLE,dwStyle|LVS_REPORT);

DWORD ExStyle =m_MyList.GetExtendedStyle();

//设置为整栏选择和网格线

m_MyList.SetExtendedStyle(ExStyle|LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);

m_MyList.InsertColumn(0,"学号",LVCFMT_CENTER,80,0);//插入LIST

m_MyList.InsertColumn(1,"姓名",LVCFMT_CENTER,60,0);

m_MyList.InsertColumn(2,"性别",LVCFMT_CENTER,40,0);

m_MyList.InsertColumn(3,"年龄",LVCFMT_CENTER,40,0);

m_MyList.InsertColumn(4,"系",LVCFMT_CENTER,260,0);

// TODO: Add extra initialization here

List("SELECT * FROM student");

return TRUE; // return TRUE unless you set the focus to a control

}

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航