精选问答
c#数据库问题(小项目)老师叫做一个显示学生的数据库 里面有学生的学号和姓名 以及照片要求实现 删除和添加学生信息的功能 核心代码为if exists (select 1from sysobjectswhere id = objectid('tstudents')and type = 'U')drop table tstudentsgo/**/create table tstudents (uid int identity,username varchar(20) not null,pic image n

2019-04-29

c#数据库问题(小项目)
老师叫做一个显示学生的数据库 里面有学生的学号和姓名 以及照片
要求实现 删除和添加学生信息的功能
核心代码为
if exists (select 1
from sysobjects
where id = object_id('t_students')
and type = 'U')
drop table t_students
go
/**/
create table t_students (
uid int identity,
username varchar(20) not null,
pic image null,
constraint PK_T_STUDENTS primary key (uid)
)
go
declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'学生信息表',
'user',@CurrentUser,'table','t_students'
go
优质解答
if exists (select 1
from sysobjects
where id = object_id('t_students')
and type = 'U')
drop table t_students
go//这里是判断数据库里有没有你要建的数据库,如果没有的话就创建数据库,接下来的是创建数据库表的代码.
if exists (select 1
from sysobjects
where id = object_id('t_students')
and type = 'U')
drop table t_students
go//这里是判断数据库里有没有你要建的数据库,如果没有的话就创建数据库,接下来的是创建数据库表的代码.
相关问答