using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.OleDb;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
string oradb = "Data Source=localhost/xe; user Id=hr; Password=hr;";
OracleConnection conn = new OracleConnection(oradb);
conn.Open();
OracleCommand cmd = new OracleCommand();
cmd.Connection = conn;
cmd.CommandText = "select sysdate from dual";
cmd.CommandType = CommandType.Text;
OracleDataReader dr = cmd.ExecuteReader();
dr.Read();
System.Console.WriteLine(dr.GetString(0));
conn.Close();
System.Console.ReadLine();
}
}
}
答案 0 :(得分:0)
重新启动DataType是DateTime。
使用dr.GetDateTime(0)
代替dr.GetString(0)