首先,建立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;
--★ 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);
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,然后直接操作即可。