快捷搜索:  as  2018  FtCWSyGV  С˵  test  xxx  Ψһ  w3viyKQx

澳门新葡亰平台9411小游戏:ExtJs、ASP.net运用Linq to SQL与SQL储存过程交互



1 基础要点

1.1 Grid后台分页

1.2 Form表单提交

1.3 前台更新、删除(store.remove)、增添(store.insert)

1.4 有webService、aspx、Handler三种措施,此处应用Handler

1.5 应用Linq to SQL进行读取数据 和 SQL储存历程的操作

1.6 文件布局

2 数据库文件

代码

create table tb_user(

use_id int primary key,

use_name varchar(20) not null,

use_sex varchar(2) not null,

use_address varchar(50) not null

);

insert into tb_user values('1','陈小','女','广东省');

insert into tb_user values('2','钟天','男','四川省');

insert into tb_user values('3','李四','男','云澳门新葡亰平台9411小游戏南省');

insert into tb_user values('4','叶茂','男','广东省');

insert into tb_user values('5','吴名','男','黑龙江');

insert into tb_user values('6','陈少敏','女','广东省');

insert into tb_user values('7','艾青','男','四川省');

insert into tb_user values('8','陈国新','男','云南省');

insert into tb_user values('9','刘宁','男','广东省');

insert into tb_user values('10','周杰','男','黑龙江');

insert into tb_user values('11','张娜','女','广东省');

insert into tb_user values('12','谢娜','女','四川省');

insert into tb_user values('13','萧青','男','云南省');

insert into tb_user values('14','叶子','男','广东省');

insert into tb_user values('15','梅工','男','黑龙江');

insert into tb_user values('16','卢可','女','广东省');

insert into tb_user values('17','吴晰','男','四川省');

insert into tb_user values('18','张天佑','男','云南省');

insert into tb_user values('19','刘德华','男','广东省');

insert into tb_user values('20','张颖','男','黑龙江');

create table tb_score(

use_id int,

sco_subject varchar(20) not null,

sco_score smallint not null,

foreign key(use_id) references tb_user(use_id)

);

insert into tb_score values('1','数学'澳门新葡亰平台9411小游戏,'97');

insert into tb_score values('2','英语','97');

insert into tb_score values('3','物理','97');

insert into tb_score values('4','数学','97');

insert into tb_score values('5','英语','97');

insert into tb_score values('6','数学','97');

insert into tb_score values('7','英语','97');

insert into tb_score values('8','物理','97');

insert into tb_score values('9','数学','97');

insert into tb_score values('10','英语','97');

insert into tb_score values('11','数学','97');

insert into tb_score values('12','英语','97');

insert into tb_score values('13','物理','97');

insert into tb_score values('14','数学','97');

insert into tb_score values('15','英语','97');

insert into tb_score values('16','数学','97');

insert into tb_score values('17','英语','97');

insert into tb_score values('18','物理','97');

insert into tb_score values('19','数学','97');

insert into tb_score values('20','英语','97');

/奸淫奸淫奸淫奸淫奸淫奸淫奸淫/

/*插入*/

/奸淫奸淫奸淫奸淫奸淫奸淫**/

--drop PROCEDURE pro_Insert_values

CREATE PROCEDURE pro_Insert_values

@inp_use_id int,

@inp_use_name nvarchar(20),

@inp_use_sex nvarchar(2),

@inp_use_address nvar澳门新葡亰平台9411小游戏char(50),

@inp_sco_subject nvarchar(20),

@inp_sco_score smallint,

@out_message nvarchar(2) output

AS

BEGIN TRAN

SET @out_message=''

BEGIN T澳门新葡亰平台9411小游戏RY

INSERT INTO tb_user VALUES(@inp_use_id,@inp_use_name,@inp_use_sex,@inp_use_address)

IF @@rowcount=0

SET @out_message='0'

INSERT INTO tb_score VALUES(@inp_use_id,@inp_sco_subject,@inp_sco_score)

IF @@rowcount=0

SET @out_message='0'

END TRY

BEGIN CATCH

SET @out_message='0'

END CATCH

IF @@ERROR0

ROLLBACK TRAN A

ELSE

if @out_message='' SET @out_message='1'

COMMIT TRAN A

go

--DECLARE @out_message nvarchar(2)

--EXEC pro_Insert_values 27,'小帆','男','广东省','语文','a',@out_message output print @out_message

/奸淫奸淫奸淫奸淫奸淫奸淫奸淫/

/*删除*/

/奸淫奸淫奸淫奸淫奸淫奸淫**/

drop PROCEDURE pro_Delete_values

CREATE PROCEDURE pro_Delete_values

@inp_use_id int,

@out_message nvarchar(2) output

AS

BEGIN TRAN

SET @out_message=''

BEGIN TRY

DELETE FROM tb_score WHERE use_id=@inp_use_id

IF @@rowcount=0

SET @out_message='0'

DELETE FROM tb_user WHERE use_id=@inp_use_id

IF @@rowcount=0

SET @out_message='0'

END TRY

BEGIN CATCH

SET @out_message='0'

END CATCH

IF @@ERROR0

ROLLBACK TRAN A

ELSE

if @out_message='' SET @out_message='1'

COMMIT TRAN

go

--declare @out_message nvarchar(2)

--EXEC pro_Delete_values 39,@out_message output print @out_message

/奸淫奸淫奸淫奸淫奸淫奸淫奸淫/

/*更新*/

/奸淫奸淫奸淫奸淫奸淫奸淫**/

--drop PROCEDURE pro_Update_values

CREATE PROCEDURE pro_Update_values

@inp_use_id int,

@inp_use_name nvarchar(20),

@inp_use_sex nvarchar(2),

@inp_use_address nvarchar(50),

@inp_sco_subject nvarchar(20),

@inp_sco_score smallint,

@out_message nvarchar(2) output

AS

set@out_message=''

BEGIN TRAN A

BEGIN TRY

UPDATE tb_score SET sco_subject=@inp_sco_subject,sco_score=@inp_sco_score WHERE use_id=@inp_use_id

if @@rowcount=0

set @out_message='0'

UPDATE tb_user SET use_name=@inp_use_name,use_sex=@inp_use_sex,use_address=@inp_use_address WHERE use_id=@inp_use_id

if @@rowcount=0

set @out_message='0'

END TRY

BEGIN CATCH

SET @out_message='0'

END CATCH

IF @@ERROR0

ROLLBAC澳门新葡亰平台9411小游戏K TRAN A

ELSE

if @out_message='' SET @out_message='1'

COMMIT TRAN A

go

--数据库存在@use_id=1

--declare @out_message nvarchar(2)

--EXEC pro_Update_values 1,'张三','男','广东省','语文',97,@out_message output print @out_message

--

--数据库不存在@use_id=10

--declare @out_message nvarchar(2)

--EXEC pro_Update_values 10,'李四','男','广东省','语文',97,@out_message output print @out_message

您可能还会对下面的文章感兴趣: