资源描述:
《数据库开发教程源码(崔巍、王晓敏清华大学出版社)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、·135·数据库应用开发教程第1章createDATABASETeachingManagentON(NAME=TeachingManagent_dat,FILENAME='c:mssqldataTeachingManagement.mdf',size=10,maxsize=50,filegrowth=5)LogON(NAME=TeachingManagent_log,FILENAME='d:mssqldataTeachingManagement.ldf',size=5,maxsize=25,filegrowth=5)createtableDep
2、artment(DepartmentIDtinyintprimarykey,DepartmentNamenvarchar(30)UNIQUENOTNULL,LeaderNamenvarchar(10)null,Officenvarchar(50)null)·135·数据库应用开发教程createtableStudent(StudentIDnvarchar(10)primarykey,DepartmentIDtinyintnotnullForeignkeyreferencesdepartment(DepartmentID),StudentNamenvarch
3、ar(10)notnull,Sexnvarchar(2)check(Sex='男'orSex='女'),BirthDaydatetimenull,ComeFromnvarchar(20)null,Statusnvarchar(4)check(StatusIN('正常','留级','休学','退学')))createtableTeacher(TeacherIDnvarchar(10)primarykey,DepartmentIDtinyintnotnullForeignkeyreferencesdepartment(DepartmentID),Teacher
4、Namenvarchar(10)notnull,Sexnvarchar(2)check(Sex='男'orSex='女'),BirthDaydatetimenull,Titlenvarchar(6)check(TitleIN('教授','副教授','讲师','助教')),Majornvarchar(20)null)createtableCourse(CourseIDnvarchar(10)Primarykey,CourseNamenvarchar(30)Notnull,CourseHoursetinyintNotnull,CourseTypenvarcha
5、r(8)Check(CourseTypeIN('公共基础','专业基础','专业选修','任意选修')),DutyTeacherIDnvarchar(10)foreignkeyreferencesTeacher(TeacherID))·135·数据库应用开发教程第2章publicdelegatevoidEventHandler(objectsender,EventArgse);this.button1.Click+=newSystem.EventHandler(this.button1_Click);Click事件的处理程序框架如下:privatevoid
6、button1_Click(objectsender,EventArgse){……}MessageBox.Show("Hello,"+textBox1.Text+"!");//
7、读取web.config节点配置stringconnectionString=ConfigurationManager.ConnectionStrings["strConn"].ConnectionString;//实例化SqlConnection对象SqlConnectionconn=newSqlConnection(connectionString);//建立连接Conn.open();<%@ApplicationLanguage="C#"%>voidApplication_Start(objectsende
8、r,EventArgse){//在应用程序启动时运行的代码}voi