Home
Manage Your Code
Snippet: OracleCommand (C#)
Title: OracleCommand Language: C#
Description: Sample string strConn = "Provider=MSDAORA;DATA SOURCE=KMEAE00006454:1521/orcl;PERSIST SECURITY INFO=True;USER ID=TRANSITION;Password=transition"; Views: 252
Author: Paulo Almeida Date Added: 12/30/2007
Copy Code  
1OracleConnection oConn = new OracleConnection(strConn);
2                try
3                {
4                    oConn.Open();
5                    OracleCommand oCmd = new OracleCommand(sSQL, oConn);
6                    oCmd.CommandText = sSQL;
7                    oCmd.CommandType = System.Data.CommandType.Text;
8                    oCmd.ExecuteStream();
9                }
10                catch (Exception ex) // catches any error
11                { Console.WriteLine(ex.Message.ToString()); }
12                finally
13                {
14                    oConn.Close();
15                    oConn.Dispose();
16                }