zoukankan      html  css  js  c++  java
  • asp.net通过oracle游标得到数据集

    首先,建立oracle下面的存储过程,如下所示:

    代码
    CREATE OR REPLACE PROCEDURE P_SZ(type IN VARCHAR2,title IN VARCHAR2,p_OutCursor out SYS_REFCURSOR)

    --★  WRITTEN BY shichaoyang
    --★  WRITTEN Date  2010-09-06
     IS
     v_sql       varchar2(5000);
    BEGIN

                    v_sql:=select * from blogInfo where gDate
    <''30'' and type='||type||' and title='||title||';

                        
    OPEN p_OutCursor FOR v_sql;
    end;

    然后在asp.net后台填写如下代码:

     IDbParameters parames = CommonBLL.ADONETHelper.AdoTemplate.CreateDbParameters();
     parames.Add(
    "type", OracleType.VarChar).Value = type.ToString();
     parames.Add(
    "title", OracleType.VarChar).Value = title.ToString();
     parames.Add(
    "p_OutCursor", OracleType.Cursor);
     parames[
    2].Direction = ParameterDirection.Output;
     DataTable newdt 
    = CommonBLL.ADONETHelper.GetDataTableBySQL(CommandType.StoredProcedure, "DB_QW.P_SZ", parames);

     这样,就获取到了datatable,然后直接操作即可。

  • 相关阅读:
    Boost练习程序(强制转换)
    4873279(1002)
    A+B Problem(1000)
    STL练习程序(去除相同元素)
    Boost练习程序(智能指针)
    Sql技巧总结
    MySql Show Status详解
    mysql show status调优
    mysql decimal、numeric数据类型
    Apache Thrift学习小记
  • 原文地址:https://www.cnblogs.com/scy251147/p/1823189.html
Copyright © 2011-2022 走看看