📜  在 c# Visual Studio 中连接 oracle 数据库 - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:40.939000             🧑  作者: Mango

代码示例1
string oradb = "Data Source=ORCL;User Id=hr;Password=hr;";
OracleConnection conn = new OracleConnection(oradb);  // C#
conn.Open(); 
OracleCommand cmd = new OracleCommand();
cmd.Connection = conn;
cmd.CommandText = "select department_name from departments where department_id = 10";
cmd.CommandType = CommandType.Text; 
OracleDataReader dr = cmd.ExecuteReader();
dr.Read();
label1.Text = dr.GetString(0);
conn.Dispose();