数据库开发教程源码(崔巍、王晓敏 清华大学出版社).doc
文本预览下载声明
第1章
create DATABASE TeachingManagent
ON
(NAME=TeachingManagent_dat,
FILENAME = c:\mssql\data\TeachingManagement.mdf,
size=10,
maxsize=50,
filegrowth=5
)
Log ON
(NAME=TeachingManagent_log,
FILENAME = d:\mssql\data\TeachingManagement.ldf,
size=5,
maxsize=25,
filegrowth=5
)
create table Department
(
DepartmentID tinyint primary key,
DepartmentName nvarchar(30) UNIQUE NOT NULL,
LeaderName nvarchar(10) null,
Office nvarchar(50) null
)
create table Student
(
StudentID nvarchar(10) primary key,
DepartmentID tinyint not null
Foreign key references department (DepartmentID),
StudentName nvarchar(10) not null,
Sex nvarchar(2) check (Sex=男 or Sex=女),
BirthDay datetime null,
ComeFrom nvarchar(20) null,
Status nvarchar(4) check (Status IN(正常,留级,休学,退学))
)
create table Teacher
(
TeacherID nvarchar(10) primary key,
DepartmentID tinyint not null
Foreign key references department(DepartmentID),
TeacherName nvarchar(10) not null,
Sex nvarchar(2) check (Sex=男 or Sex=女),
BirthDay datetime null,
Title nvarchar(6) check (Title IN(教授,副教授,讲师,助教)),
Major nvarchar(20) null
)
create table Course(
CourseID nvarchar(10) Primary key,
CourseName nvarchar(30) Not null,
CourseHourse tinyint Not null,
CourseType nvarchar(8)
Check(CourseType IN (公共基础,专业基础,专业选修,任意选修)),
DutyTeacherID nvarchar(10) foreign key references Teacher (TeacherID)
)
第2章
public delegate void EventHandler(object sender, EventArgs e);
this.button1.Click += new System.EventHandler(this.button1_Click);
Click事件的处理程序框架如下:
private void button1_Click(object sender, EventArgs e)
{
……
}
MessageBox.Show(Hello, + textBox1.Text + !);
connectionStrings
!--SQL Serve数据库配置,服务器名是:MIS\ SQLEXPRESS,数据库名是:Test--
add name=strConn connectionString=Data Source= MIS\ SQLEXPRESS;Database= Test;
integrated security=true/
/connectionStrings
//读取web.config节点配置
string connectionString = ConfigurationManager.ConnectionStrings[strConn].ConnectionString;
//实例化SqlConnection对象
S
显示全部