Data Access Application Block 是一个 .NET 组件,包含优化的数据访问代码,可以帮助用户调用存储过程以及向 SQL Server 数据库发出 SQL 文本命令。它返回 SqlDataReader、DataSet 和 XmlReader 对象。您可以在自己的 .NET 应用程序中将其作为构造块来使用,以减少需要创建、测试和维护的自定义代码的数量。检索存储过程参数
SqlHelperParameterCache 还提供了针对特定存储过程检索参数数组的方法。一种名为 GetSpParameterSet 的重载方法提供了此功能,它包含两种实现。该方法尝试从缓存中检索特定存储过程的参数。如果这些参数尚未被缓存,则使用 .NET 的 SqlCommandBuilder 类从内部检索,并将它们添加到缓存中,以便用于后续的检索请求。然后,为每个参数指定相应的参数设置,最后将这些参数以数组形式返回给客户端。以下代码显示了如何检索 Northwind 数据库中 SalesByCategory 存储过程的参数。[Visual Basic]
' 初始化连接字符串和命令文本
' 它们将构成用来存储和检索参数的键
Const CONN_STRING As String = _
  "SERVER=(local); DATABASE=Northwind; INTEGRATED SECURITY=True;"
Dim spName As String = "SalesByCategory"' 检索参数
Dim storedParams(1) As SqlParameter
storedParams = SqlHelperParameterCache.GetSpParameterSet( _
                                          CONN_STRING, spName)
storedParams(0).Value = "Beverages"
storedParams(1).Value = "1997"' 在命令中使用参数
Dim ds As DataSet
ds = SqlHelper.ExecuteDataset(CONN_STRING, _
                              CommandType.StoredProcedure, _
                              spName, storedParams)[C#]
// 初始化连接字符串和命令文本
// 它们将构成用来存储和检索参数的键
const string CONN_STRING = 
  "SERVER=(local); DATABASE=Northwind; INTEGRATED SECURITY=True;";
string spName = "SalesByCategory";// 检索参数
SqlParameter storedParams = new SqlParameter[2];
storedParams = SqlHelperParameterCache.GetSpParameterSet(
                                          CONN_STRING, spName);
storedParams[0].Value = "Beverages";
storedParams[1].Value = "1997";// 在命令中使用参数
DataSet ds;
ds = SqlHelper.ExecuteDataset(CONN_STRING, 
                              CommandType.StoredProcedure,
                              spName, storedParams);

解决方案 »

  1.   

    http://www.sqldts.com/default.aspx?234
    不知道是不是你所需要的,感觉这个问题很难,但是如果存储过程是经过编译的旧能够得出
    帮你顶
      

  2.   

    OK,兄弟,你很幸运,找到了一个方法,看看下面这篇文章
    http://support.microsoft.com/kb/q165156/
      

  3.   

    <%@ LANGUAGE = VBScript %>
       <!-- #INCLUDE VIRTUAL="/ASPSAMP/SAMPLES/ADOVBS.INC" -->
       <HTML>
       <HEAD><TITLE>Stored Proc Example</TITLE></HEAD>
       <BODY>   <%
       Set Conn = Server.CreateObject("ADODB.Connection")   ' The following line must be changed to reflect your data source info
       Conn.Open "data source name", "user id", "password"
       set cmd = Server.CreateObject("ADODB.Command")
       set cmd.ActiveConnection = Conn   ' Specify the name of the stored procedure you wish to call
        cmd.CommandText = "sp_MyStoredProc"
        cmd.CommandType = adCmdStoredProc    ' Query the server for what the parameters are
        cmd.Parameters.Refresh
       %>
       <Table Border=1>
       <TR>
          <TD><B>PARAMETER NAME</B></TD>
          <TD><B>DATA-TYPE</B></TD>
          <TD><B>DIRECTION</B></TD>
          <TD><B>DATA-SIZE</B></TD>
       </TR>
       <% For Each param In cmd.Parameters %>
       <TR>
          <TD><%= param.name %></TD>
          <TD><%= param.type %></TD>
          <TD><%= param.direction %></TD>
          <TD><%= param.size %></TD>
       </TR>
       <%
        Next
        Conn.Close
       %>呵呵param的属性就解决了,使用了一个For Each param In cmd.Parameters 
    得到param
      

  4.   

    http://dev.csdn.net/develop/article/47/47791.shtm
    http://dev.csdn.net/develop/article/27/27048.shtm
    http://dev.csdn.net/develop/article/31/31467.shtmcsdn的文档中的  看看有能给你启发的吗 ?
      

  5.   

    <%@ LANGUAGE = VBScript %>
       <!-- #INCLUDE VIRTUAL="/ASPSAMP/SAMPLES/ADOVBS.INC" -->
       <HTML>
       <HEAD><TITLE>Stored Proc Example</TITLE></HEAD>
       <BODY>   <%
       Set Conn = Server.CreateObject("ADODB.Connection")   ' The following line must be changed to reflect your data source info
       Conn.Open "data source name", "user id", "password"
       set cmd = Server.CreateObject("ADODB.Command")
       set cmd.ActiveConnection = Conn   ' Specify the name of the stored procedure you wish to call
        cmd.CommandText = "sp_MyStoredProc"
        cmd.CommandType = adCmdStoredProc    ' Query the server for what the parameters are
        cmd.Parameters.Refresh
       %>
       <Table Border=1>
       <TR>
          <TD><B>PARAMETER NAME</B></TD>
          <TD><B>DATA-TYPE</B></TD>
          <TD><B>DIRECTION</B></TD>
          <TD><B>DATA-SIZE</B></TD>
       </TR>
       <% For Each param In cmd.Parameters %>
       <TR>
          <TD><%= param.name %></TD>
          <TD><%= param.type %></TD>
          <TD><%= param.direction %></TD>
          <TD><%= param.size %></TD>
       </TR>
       <%
        Next
        Conn.Close
       %>呵呵param的属性就解决了,使用了一个For Each param In cmd.Parameters 
    得到param---用c#如何实现!!!!!
      

  6.   

    <%@ LANGUAGE = VBScript %>
       <!-- #INCLUDE VIRTUAL="/ASPSAMP/SAMPLES/ADOVBS.INC" -->
       <HTML>
       <HEAD><TITLE>Stored Proc Example</TITLE></HEAD>
       <BODY>   <%
       Set Conn = Server.CreateObject("ADODB.Connection")   ' The following line must be changed to reflect your data source info
       Conn.Open "data source name", "user id", "password"
       set cmd = Server.CreateObject("ADODB.Command")
       set cmd.ActiveConnection = Conn   ' Specify the name of the stored procedure you wish to call
        cmd.CommandText = "sp_MyStoredProc"
        cmd.CommandType = adCmdStoredProc    ' Query the server for what the parameters are
        cmd.Parameters.Refresh
       %>
       <Table Border=1>
       <TR>
          <TD><B>PARAMETER NAME</B></TD>
          <TD><B>DATA-TYPE</B></TD>
          <TD><B>DIRECTION</B></TD>
          <TD><B>DATA-SIZE</B></TD>
       </TR>
       <% For Each param In cmd.Parameters %>
       <TR>
          <TD><%= param.name %></TD>
          <TD><%= param.type %></TD>
          <TD><%= param.direction %></TD>
          <TD><%= param.size %></TD>
       </TR>
       <%
        Next
        Conn.Close
       %>呵呵param的属性就解决了,使用了一个For Each param In cmd.Parameters 
    得到param---用c#如何实现!!!!!
      

  7.   

    up  and   !!
      

  8.   

    orcale中类似一下
    select 
    overload, 
    decode(position,0,'RETURN_VALUE',nvl(argument_name,chr(0))) name, 
    decode(in_out,'IN',1,'IN/OUT',3,'OUT',decode(argument_name,null,6,2),1) direction, 
    decode(data_type, 'BFILE',101, 'BLOB',102, 'CHAR',104, 'CLOB',105, 'DATE',106, 'FLOAT',122, 'INTERVAL YEAR TO MONTH',115, 'INTERVAL DAY TO SECOND',114, 'LONG',109, 'LONG RAW',110, 'NCHAR',117, 'NCLOB',116, 'NUMBER',107, 'NVARCHAR2',119, 'RAW',120, 'REF CURSOR',121, 'ROWID',16, 'TIMESTAMP',123, 'TIMESTAMP WITH LOCAL TIME ZONE',124, 'TIMESTAMP WITH TIME ZONE',125, 'VARCHAR2',126,126) oracletype, 
    decode(data_type, 'CHAR',2000, 'LONG',2147483647, 'LONG RAW',2147483647, 'NCHAR',4000, 'NVARCHAR2',4000, 'RAW',2000, 'VARCHAR2',2000,0) length, 
    nvl(data_precision, 255) precision, 
    nvl(data_scale, 255) scale 
    from 
    all_arguments 
    where 
    data_level = 0 and 
    data_type is not null and 
    owner = 'SYSTEM' and 
    object_name = 'TESTPROC'  
    order by 
    overload, position;