'Declaration Public Class OracleSqlStatement Inherits Devart.Common.SqlStatement
public class OracleSqlStatement : Devart.Common.SqlStatement
'Declaration Public Class OracleSqlStatement Inherits Devart.Common.SqlStatement
public class OracleSqlStatement : Devart.Common.SqlStatement
string script = "DROP TABLE DEPT;" + "CREATE TABLE DEPT (" + " DEPTNO NUMBER(38) NOT NULL," + " DNAME VARCHAR2(14)," + " LOC VARCHAR2(13)" + ");" + "INSERT INTO DEPT VALUES (10,'ACCOUNTING','NEW YORK');" + "INSERT INTO DEPT VALUES (20,'RESEARCH','DALLAS');" + "INSERT INTO DEPT VALUES (30,'SALES','CHICAGO');" + "INSERT INTO DEPT VALUES (40,'OPERATIONS','BOSTON');" + "SELECT * FROM DEPT"; OracleConnection myConn = new OracleConnection("User Id=Scott;Password=tiger;Data Source=Ora1110"); OracleScript myScript = new OracleScript(script, myConn); OracleSqlStatementCollection myColl = myScript.Statements; IDataReader myReader; myConn.Open(); foreach (OracleSqlStatement myStatement in myColl) { Console.WriteLine(myStatement.Text); try { myReader = myStatement.Execute(); Console.WriteLine(" Records affected " + myReader.RecordsAffected); while (myReader.Read()) { Console.WriteLine(myReader.GetString(0)); } myReader.Close(); Console.WriteLine(); } catch { Console.WriteLine(" Failed"); } } myConn.Close();
Dim script As String = _ "DROP TABLE DEPT;" & _ "CREATE TABLE DEPT (" + _ " DEPTNO NUMBER(38) NOT NULL," & _ " DNAME VARCHAR2(14)," & _ " LOC VARCHAR2(13)" & _ ");" & _ "INSERT INTO DEPT VALUES (10,'ACCOUNTING','NEW YORK');" & _ "INSERT INTO DEPT VALUES (20,'RESEARCH','DALLAS');" & _ "INSERT INTO DEPT VALUES (30,'SALES','CHICAGO');" & _ "INSERT INTO DEPT VALUES (40,'OPERATIONS','BOSTON');" & _ "SELECT * FROM DEPT"; Dim myConn As New OracleConnection("User Id=Scott;Password=tiger;Data Source=Ora1110") Dim myScript As New OracleScript(script, myConn) Dim myColl As OracleSqlStatementCollection = myScript.Statements myConn.Open Dim myStatement As OracleSqlStatement For Each myStatement In myColl Console.WriteLine(myStatement.Text) Try Dim myReader As IDataReader = myStatement.Execute Console.WriteLine((" Records affected " & myReader.RecordsAffected)) Do While myReader.Read Console.WriteLine(myReader.GetString(0)) Loop myReader.Close Console.WriteLine Catch obj1 As Object Console.WriteLine(" Failed") End Try Next myConn.Close
System.Object
Devart.Common.SqlStatement
Devart.Data.Oracle.OracleSqlStatement
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2