PL/SQL Example Code (C#.NET 4.0)
Posted on 2012-03-12
I'm from a C#.NET 4.0 + Linq background and I just started with PL/SQL. I am trying to query a database and obtain two values which I can then use in my C# code.
Here is the C# code I have so far:
string sqlstmt1 = "SELECT ZIR_EMAIL As Email, EMP_DEPARTMENT As Dept " +
"FROM MYTABLE " +
"WHERE " +
"UPPER(UNAME) == " + UserName;
OracleConnection oraConn = new OracleConnection(ConfigurationManager.ConnectionStrings["CONN"].ConnectionString);
OracleCommand oraCmd = new OracleCommand(sqlstmt1, oraConn);
oraCmd.CommandType = CommandType.Text;
oraCmd.CommandTimeout = 300;
DataSet ds = new DataSet();
OracleDataAdapter oraDA = new OracleDataAdapter(oraCmd);
OracleCommandBuilder oraCB = new OracleCommandBuilder(oraDA);
I need to put the values of Email and Dept into C# string variables, but I am not certain how to accomplish this.