本文为本人(iihero)原创,如若转载,请尊重个人劳动,务必注明原始出处。
在ASE里使用ado.net,基本上常见的有两种方式,一种是使用oledb方式(dotnet系统框架自带),一种是直接使用ASE自带的adonet库来访问。想获取高性能,后者为佳。
而每种方式对store procedure的调用,也可以分两种模式,一种是显示指定这是调用存储过程,另一种是采取传统的存储过程调用文本方式:"{call test_proc(?, ?)}",这表示调用存储过程,带两个参数。
简单的SQL CUD操作或者SELECT查询,就不用介绍了,本文同样适合这些情形的处理。
下边是一个详细的示例,既有输出参数,同时又有输出的结果集。准备工作:
创建下述的表和示例存储过程:test_proc
create table spring.student ( sno int not null primary key, sname varchar(32) not null, sgender char(1) not null, sbirth datetime not null, sage numeric(2) null, sdept varchar(128) null ) go insert into student values(2007001, '李勇', 'M', '1987-9-1', null, 'CS') insert into student values(2007002, '刘晨', 'F', '1988-10-22', null, 'IS') insert into student values(2007003, '王敏', 'F', '1990-2-3', null, 'MA') i