SQLserver数据库课程设计方案_第1页
SQLserver数据库课程设计方案_第2页
SQLserver数据库课程设计方案_第3页
已阅读5页,还剩11页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、淮海 工学院 计算机工程学院课程设计报告设计名称:数据库课程设计姓 名:学 号:专业班级:网络121系 (院): 计算机工程学院设计时间: 20146192014625设计地点:机房、宿舍、文通楼、图书馆成绩:指导教师评语:签名: 需求分析目前,大多数文档管理系统在实现了企业各部门日常文件管理的基本功能外,还增设了很多的新功 能用以满足文档管理电子化、标准化的新要求,功能强大的档案查询模块大大方便了管理者日常查 找文档的工作,解决了传统管理中查找困难、查找耗时间等问题。使用现代化的文档管理系统满足 了企业“无纸化”的办公要求,实现了通过计算机对文档管理全程跟踪的要求。概念结构设计1.系统功能结

2、构2.业务流程图数据库备份广数据库管理 数据库还原*添加文档文档管理信息4修改文档集删除文档集三、物理结构设计系统表_1 Dwxxbdbo2006/3/15Rhhibdbc2006/3/25 Usersdbo2CX6/3/14_3 Zdmlbdbo2006/3/23 Zdxxbdbc200&/3/24文档表DWbhL0bhL0nca1学生信息卜3计尊机就业情况NLUAUZNULL单位表表-dbo,Dwxxb XDWbhDWmcLxrLxdhLxdzMemoEJ淮海工学垸陶玉灿1636057738卷梧路労号2计算机学院李存华1238765342计茸机工程学NULLNULLNtALAtfiZNUL

3、LNLAL文档表DWbhWbhWDbhWDhkGJzWJtjMerroTjrmrNULLAUNULLMJILMJLLNULLULL用户表UsernamePwdJBmrmrsoft1mrlq1111ydq1230NULL四、应用系统实现与测试登陆界面系统界面咖军岂理9:m圈園眄靱栏呜I徹间舷栏査看犀性A用户肯理日确理IO日亡基本倍息琶遅 业r蛙海工学碗 出、计耳机字院百林除E科技可限QR当前用户;e当前日朗;14gZ7文档基本信息用户名naruto naruto nruto naruto naruto narut o改改改修修修录录fefef他录_登登单单单登-日志管理登录时间动作05-03-2

4、506-03-2506-03-2506-03-2505-03-256-03-25文档基本信息哲文栏苣1冬基本信息信患删除|单位列表单位编号单位名称II.联系人I联系电话联系士1淮海工学院陶玉算机学院1238765342计刖五、部分代码/ ADO.cpp: impleme ntation of the CADO class./#include stdafx.h#i nclude ADO.h#in clude #ifdef _DEBUG#un def THIS_FILEstatic char THIS_FILE=_FILE_;#defi ne new DEBUG_NEW#

5、en dif/ Con structio n/Destructio n/int Co nCou nt = 0;CADOCo nn ection g_Co nn ectio n;全局数据库连接对象CADOCo nn ection * GetCo nn ectio n()retur n &g_Conn ecti on;CADOCo nn ectio n:CADOCo nn ectio n()In itADO();m_Co nn ectio n.Create In sta nce(ADODB.Co nn ectio n);CADOCo nn ectio n:CADOCo nn ectio n() i

6、f (IsOpe n()m_Connection-Close();m_Co nn ection = NULL;UnIn itADO();void CADOCo nn ectio n:l ni tADO()if (Co nCou nt+ = 0)CoI nitialize(NULL);void CADOCo nn ectio n:U nlni tADO() if (-Co nCou nt = 0)CoUnin itialize();BOOL CADOCo nn ectio n:Ope n(CStri ng Co nStr)if (IsOpe n()m_Connection-Close();m_C

7、o nn ectio n-Ope n( (_bstr_t)Co nStr,adModeU nknown); return IsOpe n();CStri ng CADOCo nn ecti on:GetSQLCo nStr(CStri ng IP, CStri ng DBName)CStri ng Str;ID=sa; In itialStr.Format(Provider=SQLOLEDB.1;PersistSecurityIn fo=False;UserCatalog=%s;Data Source=%s,DBName,IP);return Str;_Co nn ectio nPtr CAD

8、OCo nn ectio n:GetCo nn ectio n()return m_C onn ectio n;BOOL CADOCo nn ectio n:lsOpe n()long State;m_Co nn ectio n-get_State(&State);if (State = adStateOpe n)return true;return false;/CADODataSet:CADODataSet()m_DataSet.Createl nsta nce(ADODB.Recordset);CADODataSet:CADODataSet()if (IsOpe n() m_DataSe

9、t-Close();m_DataSet = NULL;m_Co nn ection = NULL;void CADODataSet:SetCo nn ectio n(CADOCo nn ection *pC on)m_Conn ecti on = pCon;int CADODataSet:GetRecordCou nt()if (IsOpe n()return m_DataSet-GetRecordCou nt();elsereturn 0;BOOL CADODataSet:Ope n(CStri ng SQLStr)if (IsOpe n()m_DataSet-Close();/*/m_Da

10、taSet-Ope n(_bstr_t(SQLStr),_varia nt_t(IDispatch*)g_C onnection. GetC onn ecti on(), true),adOpe nKeyset, adLockOptimistic, adCmdText);return IsOpe n();/*/BOOL CADODataSet:IsOpe n()long State;m_DataSet-get_State(&State);if (State = adStateOpe n)return true;return false;FieldsPtr CADODataSet:GetFiel

11、ds()return m_DataSet-GetFields();BOOL CADODataSet:Next()if (m_DataSet-adoEOF)return false;m_DataSet-MoveNext();return true;void CADODataSet:AddNew()m_DataSet-AddNew();void CADODataSet:SetFieldValue(CStri ng FieldName, _varia nt_t Value)m_DataSet-PutCollect(_bstr_t)FieldName,Value);void CADODataSet:S

12、ave()m_DataSet-Update();void CADODataSet:move(i nt nln dex)m_DataSet-MoveFirst(); m_DataSet-Move( nln dex);int CADODataSet:GetRecordNo()retur n m_DataSet-AbsolutePositi on;void CADODataSet:Delete()m_DataSet-Delete(adAffectCurre nt);BOOL CADODataSet:Ope n(CStri ng SQLStr, i nt LockType)if (IsOpe n()m

13、_DataSet-Close();/*/m_DataSet-Ope n(_bstr_t(SQLStr),_varia nt_t(IDispatch*)g_C onnection. GetC onn ecti on(), true),adOpe nKeyset,(LockTypeE num) LockType, adCmdText);return IsOpe n();/ CheckSum.cpp : implementation file/#include stdafx.h#in clude Pers on .h#in clude CheckSum.h#ifdef DEBUG#defi ne n

14、ew DEBUG_NEW#un def THIS_FILEstatic char THIS_FILE = _FILE_;#en dif/ CCheckSum dialogCCheckSum:CCheckSum(CWnd* pPare nt /*=NULL*/) :CDialog(CCheckSum:IDD, pParent)AFX_DATA_INIT(CCheckSum) m_emp = _T();m_mm = _T();m_yy = _T();AFX_DATA_INIT void CCheckSum:DoDataExcha nge(CDataExcha nge* pDX) CDialog:D

15、oDataExcha nge(pDX);AFX_DATA_MAP(CCheckSum)DDX_C on trol(pDX, IDC_LISTEMP, m_list);DDX_Co ntrol(pDX, IDC_CYY, m_cyy);DDX_C on trol(pDX, IDC_CMM, m_cmm);DDX_Co ntrol(pDX, IDC_CEMP, m_cemp);DDX_CBStri ng(pDX, IDC_CEMP, m_emp);DDX_CBStri ng(pDX, IDC_CMM, m_mm);DDX_CBStri ng(pDX, IDC_CYY, m_yy); /AFX_DA

16、TA_MAPBEGIN_MESSAGE_MAP(CCheckSum, CDialog)AFX_MSG_MAP(CCheckSum)ON_CBN_CLOSEUP(IDC_CEMP, On CloseupCemp)ON_CBN_CLOSEUP(IDC_CYY, On CloseupCyy)ON_CBN_CLOSEUP(IDC_CMM, On CloseupCmm) /AFX_MSG_MAPEND_MESSAGE_MAP() / CCheckSum message han dlersBOOL CCheckSum:O nlni tDialog()CDialog:O nlni tDialog();int

17、 i = 0;mist.lnsertColumn(i,人员姓名”);mist.SetColu mn Width(i+,100);mist.lnsertColumn(i,工作总天数”);mist.SetColu mn Width(i+,100);mist.lnsertColumn(i,迟到总天数”);mist.SetColu mn Width(i+,100);mist.lnsertColumn(i,早退总天数”);mist.SetColu mn Width(i+,100);mist.lnsertColumn(i,病假总天数”);mist.SetColu mn Width(i+,100);mist

18、.lnsertColumn(i,事假总天数”);mist.SetColu mn Width(i+,100);mist.SetExte ndedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);int curyear,curm on th;CTime time(CTime:GetCurre ntTime();curyear = time.GetYear();curm onth = time.GetM on th();char value10;for (int y = 2000; y 2100 ;y+)_itoa(y,value,10);m_cyy.l ns

19、ertStri ng(y-2000,value);m_cyy.SetCurSel(curyear-2000);for (int n = 1 ; n=12 ;n+)_itoa( n, value,10);m_cm m.ln sertStri ng(n-1,value);m_cmm.SetCurSel(curm on th-1);CADODataSet dataset;dataset.SetC onnection (:GetC onn ecti on();dataset.Ope n(Select * From tab_Employees);m_cemp.lnsertString(0,(全部);fo

20、r (int in dex = 1 ; in dex ltememp _n ame-Value);dataset.Next(); m_cemp.SetCurSel(O);UpdateList();return TRUE; / return TRUE uni ess you set the focus to a con trol/ EXCEPTION: OCX Property Pages should return FALSEvoid CCheckSum:UpdateList()mist.DeleteAllltems();this-UpdateData();CADODataSet datase

21、t;dataset.SetC onnection (:GetC onn ecti on();CString str,temp,where,datestr,StartDate,EndDate;StartDate = m_yy + - + m_mm + -1;En dDate.Format(DATEADD(mo nth,1,%s),StartDate); datestr.Format( betwee n %s and %s,StartDate,E ndDate);/*/temp += select emp.emp_ name ,ROUND(is null(works.workday,0),2);t

22、emp += workday,ROUND(isnull(lates.lateday,0),2) lateday,;temp += ROUND(is null(leaveearlys.leaveearlyday,0),2) leaveearlyday,;temp += ROUND(isnull(bjdays.bjday,0),2)bjday,ROUND(isnull(sjdays.sjday,0),2)sjday;temp += from tab_Employees emp ;temp += left joi n;temp += (select sum(DATEDIFF(seco nd,o nt

23、ime,offtime) / 60.0 / 60.0 / 8.0;temp += as workday ,n ame From tab_Check where checkdate %s group by n ame);temp += works on emp.emp _n ame = works. name;temp += left joi n;temp += (select (sum(DATEPART(Hour,latetime) * 60 * 60 + ;temp += sum(DATEPART(minute,latetime) * 60 + sum(DATEPART(second,lat

24、etime);temp += /60.0 /60.0 /8.0 as lateday, name From tab_Check where checkdate;temp += %s group by n ame) lates on emp.emp_ name = lates .n ame;temp += left joi n;temp += (select (sum(DATEPART(Hour,leaveearly) * 60 * 60 + ;temp += sum(DATEPART(mi nute,leaveearly) * 60 + sum(DATEPART(seco nd,leaveea

25、rly);temp += /60.0 /60.0 /8.0 as leaveearlyday ,n ame From tab_Check where ;temp += checkdate %s group by n ame) leaveearlys on emp.emp_ name;temp += = leaveearlys .n ame;temp += left joi n;temp += (select isn ull(sum(DATEDIFF(sec ond,onl eave,offleave);temp += / 60.0 / 60.0 / 8.0,0) as bjday,name F

26、rom tab_Check where;temp += leave = 病假and checkdate %s group by n ame);temp += bjdays on emp.emp_ name = bjdays .n ame;temp += left joi n;temp += (select isn ull(sum(DATEDIFF(sec ond,onl eave,offleave);temp += / 60.0 / 60.0 / 8.0,0) as sjday, name From tab_Check where ;temp += leave = 事假and checkdat

27、e %s group by n ame);temp += sjdays on emp.emp_ name = sjdays .n ame;temp += %s;/*/where.Format(” where emp.emp_ name = %s,m_emp);if (m_emp =( 全部) str.Format(temp,datestr,datestr,datestr,datestr,datestr,);else str.Format(temp,datestr,datestr,datestr,datestr,datestr,where);/*/dataset.Ope n( str,adLock Un specified);for (int i = 0; i ltememp_ name-Value);m_l ist.SetItemText(i, n+,(_bstr_t)dataset.GetFields()-ltemworkday-Value);m_l ist.SetItemText(i, n+,(_bstr_t)dataset.GetFields

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论