CREATE TABLE SysUser
(
UserID NCHAR(20) PRIMARY KEY,
UserPassWord NCHAR(32) NOT NULL,
UserSchoolID NCHAR(20) NOT NULL,
UserMobile NCHAR(11) NOT NULL,
UserBirthday datetime,
UserIdentity NCHAR(20) NOT NULL,
UserPhoto image
);
CREATE TABLE SysLog
(
UserID NCHAR(20) ,
DateAndTime datetime,
UserOperation NCHAR(200)
);
CREATE TABLE Student
(
Sno CHAR(9) PRIMARY KEY, /* 列级完整性约束条件,Sno是主码*/
Sname CHAR(20) UNIQUE,
Ssex CHAR(2) NOT NULL,check (Ssex in ('男','女')),
Sage SMALLINT NOT NULL,check (Sage>0),
Sdept CHAR(20)
);
CREATE TABLE Course
(
Cno CHAR(4) PRIMARY KEY,
Cname CHAR(40) NOT NULL,
Cpno CHAR(4),
Ccredit SMALLINT NOT NULL,
FOREIGN KEY (Cpno) REFERENCES Course(Cno)
);
CREATE TABLE SC
(
Sno CHAR(9),
Cno CHAR(4),
Grade SMALLINT,
PRIMARY KEY (Sno,Cno), /* 主码由两个属性构成,必须作为表级完整性进行定义*/
FOREIGN KEY (Sno) REFERENCES Student(Sno), /* 表级完整性约束条件,Sno是外码,被参照表是Student */
FOREIGN KEY (Cno)REFERENCES Course(Cno) /* 表级完整性约束条件, Cno是外码,被参照表是Course*/
);
INSERT INTO SysUser VALUES ('admin','123','000','13812345678',1999-1-1,'0',NULL);
INSERT INTO Student (Sno,Sname,Ssex,Sdept,Sage) VALUES ('201215121','李勇','男','CS',20);
INSERT INTO Student (Sno,Sname,Ssex,Sdept,Sage) VALUES ('201215122','刘晨','女','CS',19);
INSERT INTO Student (Sno,Sname,Ssex,Sdept,Sage) VALUES ('201215123','王敏','女','MA',18);
INSERT INTO Student (Sno,Sname,Ssex,Sdept,Sage) VALUES ('201215125','张立','男','IS',19);
INSERT INTO Student (Sno,Sname,Ssex,Sdept,Sage) VALUES ('201215128','陈冬','男','IS',20);
INSERT INTO Student (Sno,Sname,Ssex,Sdept,Sage) VALUES ('201215129','李丽','女','IS',20);
INSERT INTO Student (Sno,Sname,Ssex,Sdept,Sage) VALUES ('201215126','陈霞','男','MA',19);
SELECT * FROM Student
INSERT INTO Course(Cno,Cname,Cpno,Ccredit) VALUES ('1','数据库',NULL,4);
INSERT INTO Course(Cno,Cname,Cpno,Ccredit) VALUES ('2','数学',NULL,4);
INSERT INTO Course(Cno,Cname,Cpno,Ccredit) VALUES ('3','信息系统',NULL,4);
INSERT INTO Course(Cno,Cname,Cpno,Ccredit) VALUES ('4','操作系统',NULL,4);
INSERT INTO Course(Cno,Cname,Cpno,Ccredit) VALUES ('5','数据结构',NULL,4);
INSERT INTO Course(Cno,Cname,Cpno,Ccredit) VALUES ('6','数据处理',NULL,4);
INSERT INTO Course(Cno,Cname,Cpno,Ccredit) VALUES ('7','Pascal语言',NULL,4);
UPDATE Course SET Cpno = '5' WHERE Cno = '1'
UPDATE Course SET Cpno = '1' WHERE Cno = '3'
UPDATE Course SET Cpno = '6' WHERE Cno = '4'
UPDATE Course SET Cpno = '7' WHERE Cno = '5'
UPDATE Course SET Cpno = '6' WHERE Cno = '7'
SELECT * FROM Course
INSERT INTO SC(Sno,Cno,Grade) VALUES ('201215121 ','1',92);
INSERT INTO SC(Sno,Cno,Grade) VALUES ('201215121 ','2',85);
INSERT INTO SC(Sno,Cno,Grade) VALUES ('201215121 ','3',88);
INSERT INTO SC(Sno,Cno,Grade) VALUES ('201215122 ','2',90);
INSERT INTO SC(Sno,Cno,Grade) VALUES ('201215122 ','3',80);
INSERT INTO SC(Sno,Cno,Grade) VALUES ('201215121 ','4',56);
INSERT INTO SC(Sno,Cno,Grade) VALUES ('201215125 ','1',85);
SELECT * FROM SC
CREATE TABLE Admin(Ano char (9) PRIMARY KEY,
Aname char(20) NOT NULL,
Asex char (2) NOT NULL,check (Asex in ('男','女')),
Asalary char(10) NOT NULL,
Atitle char(10));
INSERT INTO Admin(Ano,Aname,Asex,Asalary,Atitle) VALUES ('1','王琦','女',5000,'副教授');
INSERT INTO Admin(Ano,Aname,Asex,Asalary,Atitle) VALUES ('2','陈宇','男',5500,'教授');
INSERT INTO Admin(Ano,Aname,Asex,Asalary,Atitle) VALUES ('3','刘宁','女',4500,'讲师');
INSERT INTO Admin(Ano,Aname,Asex,Asalary,Atitle) VALUES ('4','王晨','女',6000,'教授');
INSERT INTO Admin(Ano,Aname,Asex,Asalary,Atitle) VALUES ('5','韩新','女',4000,'讲师');
INSERT INTO Admin(Ano,Aname,Asex,Asalary,Atitle) VALUES ('6','王韩','女',5400,'教学秘书');
select *
from Admin
string username = textBoxtea.Text.Trim(); //取出账号
string password = EncryptWithMD5(textBoxcher.Text.Trim()); //取出密码并加密
string myConnString = "Data Source=.;Initial Catalog=curricula_variable_system;Persist Security Info=True;User ID=sa;Password=sql";//连接数据库
SqlConnection sqlConnection = new SqlConnection(myConnString);
//实例化连接对象
sqlConnection.Open();
string sql = "select UserID,UserPassWord from Teacher where UserID = '" + username + "' and UserPassWord = '" + password + "'"; //教工号:admin,密码:123
//编写SQL命令
SqlCommand sqlCommand = new SqlCommand(sql, sqlConnection);
SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
if (sqlDataReader.HasRows && textBoxyan.Text == code)
{
MessageBox.Show("欢迎使用!"); //登录成功
Form6 form6 = new Form6();
form6.Show();
this.Hide();
}
else
{
MessageBox.Show("登录失败!");
return;
}
sqlDataReader.Close();
sqlConnection.Close();
try
{
string connString = "Data Source=.;Initial Catalog=curricula_variable_system;Persist Security Info=True;User ID=sa;Password=sql";//数据库连接字符串
SqlConnection connection = new SqlConnection(connString);//创建connection对象 //打开数据库连接
connection.Open();
//创建SQL语句
string sql = "select UserPhoto from SysUser where UserSchoolID = '" + textBox1.Text + "'";
//创建SqlCommand对象
SqlCommand command = new SqlCommand(sql, connection);
//创建DataAdapter对象
SqlDataAdapter dataAdapter = new SqlDataAdapter(command);
//创建DataSet对象
DataSet dataSet = new DataSet();
dataAdapter.Fill(dataSet, "SysUser");
int c = dataSet.Tables["SysUser"].Rows.Count;
if (c > 0)
{
Byte[] mybyte = new byte[0];
mybyte = (Byte[])(dataSet.Tables["SysUser"].Rows[c - 1]["UserPhoto"]);
MemoryStream ms = new MemoryStream(mybyte);
pictureBox2.Image = Image.FromStream(ms);
}
else
{
pictureBox2.Image = null;
MessageBox.Show("无照片");
}
connection.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
String StuID = textBox1.Text.Trim();
String StuName = textBox2.Text.Trim();
SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=curricula_variable_system;User ID=sa;Password=sql");
try
{
con.Open();
string insertStr = "UPDATE Student SET Sname = '" + StuName + "' WHERE Sno = '" + StuID + "'";
SqlCommand cmd = new SqlCommand(insertStr, con);
cmd.ExecuteNonQuery();
}
catch
{
MessageBox.Show("输入数据违反要求!");
}
finally
{
con.Dispose();
}
this.studentTableAdapter.Fill(this.curricula_variable_systemDataSet3.Student);
string Coucno = textBox1.Text.Trim();
string Couname = textBox2.Text.Trim();
string Coucredit = textBox3.Text.Trim();
string Coupno = textBox4.Text.Trim();
SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=curricula_variable_system;User ID=sa;Password=sql");
try
{
con.Open();
string insertStr = "I
℡抹來的憧憬
- 粉丝: 12
- 资源: 2
最新资源
- 基于Vue3、.NET8的mes-TMom生产制造系统设计源码
- 基于FPGA的灰度直方图均衡算法IP verilog源码 适用于Altera平台,封装好的IP,可直接在Qsys中调用 本为封装好的IP源码,经过Modelsim仿真验证和开发板功能验证OK
- 基于Python和HTML的气象数据分析系统设计与实现源码
- 基于Spring Boot的quartz分布式定时任务设计源码
- 安川代码移植的主板原理图 无pcb 采用瑞萨芯片
- 基于Python的平面五杆机构狗腿形态学/小贱钟模拟器设计源码
- PSO-BP粒子群优化BP神经网络多输入多输出(Matlab完整源码和数据)
- Pscad仿真模型程序-中低压交直流混合微电网协调控制和并离网切仿真 具体工况:DC-AC-LVGrid-End1:并离网切仿真,负载和电源功率不扰动DC-AC-LVGrid-End2:并离网切,负载
- 基于Java的跨平台数据流处理框架Sylph设计源码
- 基于Java语言的公开Webservice调用天气预报功能设计源码
- 基于Java及HTML的温州理工学院web应用系统开发课程课件设计源码
- 基于Vue3框架的LYMusic音乐网站设计源码
- 基于ThinkPHP的caozha-tp-comment轻量级评论系统设计源码
- HFSS仿真实例模型文件
- 基于阿里巴巴Java开发手册的在线版JavaScript+CSS+HTML设计源码
- 基于Java OSS API的统一对象存储操作设计源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
评论0