根据存储过程的参数名得到存储过程的参数信息???????

王朝other·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

declare @ProID bigint

select @ProID=id from sysobjects where type='p' and name=@ProdecureName

select a.name N'参数名' ,

COLUMNPROPERTY(@ProID,a.name,'PRECISION') as N'长度',

a.length N'占用字节数',

a.isoutparam N'是否输入参数',

a.xprec N'精度',isnull(COLUMNPROPERTY(@ProID,a.name,'Scale'),0) as N'小数位数',

--colid ,可以不要这个

b.name N'数据类型'

from syscolumns a,systypes b

where id=@ProID and b.xusertype=a.xusertype

当然这个语句还有问题的:

如何判断是否有返回值的问题没有解决;

不过我在分析器里面看到每一个存储过程好像都有返回值。不知道是不是对的

如果,能将对(N》=1)表的操作和相应的存储过程(如:添加,删除,修改,更新等)封装到

一个对应的实体类中,应该对性能的提高有一定的帮助的

当然,好像对特定的查询没有什么太大的意义

如下:

using System;

using System.EnterpriseServices ;

using System.Data .SqlClient ;

namespace SevCompant

{

public interface IDataConnection

{

/// <summary>

/// 数据库连接

/// </summary>

SqlConnection DataBaseConnection

{

get{}

}

}

/// <summary>

/// Class1 的摘要说明。

/// </summary>

[EventTrackingEnabled(true)]

[Transaction(TransactionOption.Supported )]

[ObjectPooling(MinPoolSize=2,MaxPoolSize=10,CreationTimeout=20000)]

[System.EnterpriseServices.ConstructionEnabled(Enabled=true,

Default="Integrated Security=SSPI;Initial Catalog=Northwind;Data Source=(local)")]

public class DataBaseEntity:System.EnterpriseServices.ServicedComponent ,IDataConnection

{

public DataBaseEntity()

{

//

// TODO: 在此处添加构造函数逻辑

//

}

protected override void Construct(string s)

{

// TODO: 添加 DBUtility.Construct 实现

this.mConnString=s;

}

private string mConnString="";

protected override bool CanBePooled()

{

// TODO: 添加 DBUtility.CanBePooled 实现

return true;

}

#region IDataConnection 成员

public SqlConnection DataBaseConnection

{

get

{

// TODO: 添加 DataBaseEntity.DataBaseConnection getter 实现

ContextUtil.DeactivateOnReturn=true;

return new SqlConnection(this.mConnString);

}

}

#endregion

}

}

如果将对某一个表的CRUD操作也封装进去,应该可以省不少的事

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航