• 大小: 249KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-08-14
  • 语言: C/C++
  • 标签: VC  SQL  Server  登陆  

资源简介

该系统是基于VC的MFC程序,程序里包括数据库备份文件,数据库是使用的SQL Server。实现的功能有:登陆功能,学生选课,管理员添加课程,删除,查看,教师评分功能!运行前要先把数据库文件还原,然后建立一个名为Student的数据源。数据库连接使用的是ODBC连接,该程序是基于单文档的MFC程序!!!

资源截图

代码片段和文件信息

// AdmADDCDialog.cpp : implementation file
//

#include “stdafx.h“
#include “Student.h“
#include “AdmADDCDialog.h“

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CAdmADDCDialog dialog


CAdmADDCDialog::CAdmADDCDialog(CWnd* pParent /*=NULL*/)
: CDialog(CAdmADDCDialog::IDD pParent)
{
//{{AFX_DATA_INIT(CAdmADDCDialog)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}


void CAdmADDCDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAdmADDCDialog)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CAdmADDCDialog CDialog)
//{{AFX_MSG_MAP(CAdmADDCDialog)
ON_BN_CLICKED(IDC_ADMADDC OnAdmAddc)
ON_BN_CLICKED(IDC_ADMCANCLES OnAdmcancles)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAdmADDCDialog message handlers

void CAdmADDCDialog::OnAdmAddc() 
{
// TODO: Add your control notification handler code here
CDatabase db;
db.OpenEx(“DSN=Student“);
CString strSQL;
CRecordset rs(&db);

CString temp1temp2temp3temp4temp5;

GetDlgItemText(IDC_EDIT1temp1);
GetDlgItemText(IDC_EDIT2temp2);
GetDlgItemText(IDC_EDIT3temp3);
GetDlgItemText(IDC_EDIT4temp4);
GetDlgItemText(IDC_EDIT5temp5);

if(temp1.IsEmpty())
{
AfxMessageBox(“课程编号不能为空!“);
return;
}

strSQL.Format(“select * from Course where courseNum=‘%s‘“temp1);
rs.Open(CRecordset::snapshotstrSQL);
int i=rs.GetRecordCount();
if(i!=0)
{
AfxMessageBox(“课程编号已经存在!“);
SetDlgItemText(IDC_EDIT1““);
return;
}

strSQL.Format(“insert into Course(courseNumcourseNamecourseTimecourseScorecourseTerm) values(‘%s‘‘%s‘‘%s‘‘%s‘‘%s‘)“temp1temp2temp3temp4temp5);
db.ExecuteSQL(strSQL);

AfxMessageBox(“添加课程成功!“);

SetDlgItemText(IDC_EDIT1““);
SetDlgItemText(IDC_EDIT2““);
SetDlgItemText(IDC_EDIT3““);
SetDlgItemText(IDC_EDIT4““);
SetDlgItemText(IDC_EDIT5““);
}

void CAdmADDCDialog::OnAdmcancles() 
{
// TODO: Add your control notification handler code here
SendMessage(WM_CLOSE);
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2338  2010-03-04 14:23  学生选课系统\Student\AdmADDCDialog.cpp

     文件       1294  2010-03-04 14:23  学生选课系统\Student\AdmADDCDialog.h

     文件       2404  2010-03-04 20:14  学生选课系统\Student\AdmADDSDialog.cpp

     文件       1292  2010-03-04 20:08  学生选课系统\Student\AdmADDSDialog.h

     文件       1046  2010-03-04 10:18  学生选课系统\Student\AdmCcDialog.cpp

     文件       1267  2010-03-04 10:18  学生选课系统\Student\AdmCcDialog.h

     文件       2920  2010-03-07 01:25  学生选课系统\Student\AdmChangecDialog.cpp

     文件       1339  2010-03-04 15:49  学生选课系统\Student\AdmChangecDialog.h

     文件       2840  2010-03-07 01:25  学生选课系统\Student\AdmChangesDialog.cpp

     文件       1343  2010-03-04 15:18  学生选课系统\Student\AdmChangesDialog.h

     文件       1948  2010-03-03 21:34  学生选课系统\Student\AdmCourseDialog.cpp

     文件       1280  2010-03-03 21:20  学生选课系统\Student\AdmCourseDialog.h

     文件       3674  2010-03-07 01:25  学生选课系统\Student\AdmDeletecDialog.cpp

     文件       1338  2010-03-04 14:46  学生选课系统\Student\AdmDeletecDialog.h

     文件       3599  2010-03-07 01:25  学生选课系统\Student\AdmDeletesDialog.cpp

     文件       1341  2010-03-04 15:34  学生选课系统\Student\AdmDeletesDialog.h

     文件       3080  2010-03-05 17:01  学生选课系统\Student\AdmDialog.cpp

     文件       1484  2010-03-04 20:01  学生选课系统\Student\AdmDialog.h

     文件       4836  2010-03-04 14:21  学生选课系统\Student\AdmStudentDialog.cpp

     文件       1432  2010-03-04 14:21  学生选课系统\Student\AdmStudentDialog.h

     文件       3628  2010-03-04 19:53  学生选课系统\Student\ChangeCourseDialog.cpp

     文件       1370  2010-03-04 16:55  学生选课系统\Student\ChangeCourseDialog.h

     文件       2376  2010-03-05 19:21  学生选课系统\Student\ChangeKey.cpp

     文件       1264  2010-03-05 19:21  学生选课系统\Student\ChangeKey.h

     文件       3541  2010-03-04 19:56  学生选课系统\Student\ChangeStudentDialog.cpp

     文件       1381  2010-03-04 19:39  学生选课系统\Student\ChangeStudentDialog.h

     文件       2588  2010-03-07 11:03  学生选课系统\Student\CJDialog.cpp

     文件       1216  2010-03-07 11:03  学生选课系统\Student\CJDialog.h

     文件       4998  2010-03-04 14:21  学生选课系统\Student\CourseDialog.cpp

     文件       1377  2010-03-04 14:20  学生选课系统\Student\CourseDialog.h

............此处省略56个文件信息

评论

共有 条评论