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,然后直接操作即可。

  • 相关阅读:
    2017年3月9日上午学习
    3.17上午
    3.16上午
    3.16下午
    3.15
    2017.3.14
    3.14
    217.3.13上午
    2017.4.7-morning
    2017.4.6-afternoon
  • 原文地址:https://www.cnblogs.com/scy251147/p/1823189.html
Copyright © 2011-2022 走看看