sql server2005返回值问题
(1)关于存储过程返回值问题(output,ruturn)
output存储过程:
alter proc usp_update
@count int output
as
set @count=(select count(*) from stu)
return存储过程:
alter proc usp_update
as
declare @count int
set @count=(select count(*) from stu)
return @count
.net代码(output):
SqlConnection con = new SqlConnection ("server=95F188CF1A24424;uid=jinzhiyuan;pwd=jinzhiyuan;database=student");
con.Open();
SqlCommand cmd = new SqlCommand("usp_update",con);
cmd.Parameters.Add("@count", SqlDbType.Int);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters["@count"].Direction = ParameterDirection.Output;
cmd.ExecuteNonQuery();
int j=(int)cmd.Parameters["@count"].Value;
Response.Write("我是刚刚才执行的值:"+j);
con.Close();
.net代码(return)
SqlConnection con = new SqlConnection("server=95F188CF1A24424;uid=jinzhiyuan;pwd=jinzhiyuan;database=student");
con.Open();
SqlCommand cmd = new SqlCommand("usp_update",con);
cmd.Parameters.Add("@count", SqlDbType.Int);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters["@count"].Direction = ParameterDirection.Ret
相关文档:
在程序的开发过程中,处理分页是大家接触比较频繁的事件,因为现在软件基本上都是与数据库进行挂钓的。但效率又是我们所追求的,如果是像原来那样把所有满足条件的记录全部都选择出来,再去进行分页处理,那么就会多多的浪费掉许多的系统处理时间。为了能够把效率提高,所以现在我们就只选择我们需要的数据,减少数据 ......
--> Title : SQL Server系统视图
--> Author : wufeng4552
--> Date : 2009-10-28
目录视图
目录视图返回 SQL Server 数据库引擎使用的信息。建议您使用目录视图这一最常用的目录元数据界面,它可为您提供最有效的方法来获取、转换并显示此信息的自定义形式。所有用户可用目录元 ......
普通MySQL运行,数据量和访问量不大的话,是足够快的,但是当数据量和访问量剧增的时候,那么就会明显发现MySQL很慢,甚至down掉,那么就要考虑优化我们的MySQL了。
优化无非是从三个角度入手:
第一个是从硬件,增加硬件,增加服务器
第二个就是对我们的MySQL服务器进行优化,增加缓存大小,开多端口,读写分开
第三个 ......
在使用SQL*Plus生成报告文件的时候,往往会因为其默认的设置导致输出的结果非常的没有可读性,下面介绍一个日常中会被用到的一个脚本,其中包含一些格式化
输出的set命令
,为了方便理解,我会在每一条set命令之后紧跟着一个简单的解释,请慢慢体会。
sqlplus -s user_name/user_password << EOF >/dev/n ......