用ADO.NET访问Oracle9i存储过程(上)
添加时间: 2008-4-23 23:10:06 作者: Oracle指导 阅读次数:16 来源: http://www.d9soft.com
// create connection
OracleConnection conn = new OracleConnection("Data Source=oracledb;
User Id=UserID;Password=Password;");
// create the command for the stored procedure
OracleCommand cmd = new OracleCommand();
cmd.Connection = conn;
cmd.CommandText = "SELECT_JOB_HISTORY.GetJobHistoryByEmployeeId";
cmd.CommandType = CommandType.StoredProcedure;
// add the parameters for the stored procedure including the REF CURSOR
// to retrieve the result set
cmd.Parameters.Add("p_employee_id", OracleType.Number).Value = 101;
cmd.Parameters.Add("cur_JobHistory", OracleType.Cursor).Direction =
ParameterDirection.Output;
// open the connection and create the DataReader
conn.Open();
OracleDataReader dr = cmd.ExecuteReader();
// output the results and close the connection.
while(dr.Read())
{
for(int i = 0; i < dr.FieldCount; i++)
Console.Write(dr[i].ToString() + ";");
Console.WriteLine();
}
conn.Close();
用ADO.NET访问Oracle9i存储过程(上)(3) 第 [1] [2] [3] 下一页
上下文章:
上一篇文章: Oracle冷备份的不完全恢复(下) 下一篇文章: 用ADO.NET访问Oracle9i存储过程(下)
相关文章:

