前几篇文章里,提供了 SqlHelper, OleDbHelper, AccessHelper 给大家共享,这篇提供一个 OracleHelper 给大家共享,来自 DAAB2.1,使用的是 微软 的.NET 自带的 OracleClient。

使用方式,和 SqlHelper 一样:

using System;
using System.Data;
using System.Data.OracleClient;
using Microsoft.ApplicationBlocks.Data;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            using (OracleDataReader dr = OracleHelper.ExecuteReader(
                "Data Source=Oral;User Id=scott;Password=tiger", 
                CommandType.Text, 
                "SELECT [field] FROM [tablename]"))
            {
                while (dr.Read())
                {
                    Console.WriteLine(dr.GetString(0));
                }
            }

            Console.Read();
        }
    }
}

相关文章:

  • 2022-01-01
  • 2022-01-21
  • 2021-06-07
  • 2022-12-23
  • 2022-01-09
猜你喜欢
  • 2021-08-09
  • 2022-02-09
  • 2022-02-02
相关资源
相似解决方案