ADO Operation Oracle database is basically the same as the original operation of MSSQL. Just use a different namespace. Here are two examples:
One. C # Read the table for Oracle database
///ADO Read Table///you need to add a namespace: Using System.Data.OracleClient//Link String stringConnString =@"User Id=system; Password=123456;data source= (DESCRIPTION = (address_list= (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1 .118) (PORT = 1521))) (Connect_data = (service_name = ORCL) ))";//Create a linkOracleConnection conn =NewOracleConnection (connstring); Conn. Open (); stringsql ="SELECT * from Help"; OracleDataAdapter Sda_tab=Neworacledataadapter (SQL, conn); DataSet DS=NewDataSet (); Sda_tab. Fill (DS); DataTable TB= ds. tables[0];
Two. C # Executes Oracle statement returns the number of rows affected
stringConnString =@"User Id=system; Password=123456;data source= (DESCRIPTION = (address_list= (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1 .118) (PORT = 1521))) (Connect_data = (service_name = ORCL) ))";//Create a linkOracleConnection conn =NewOracleConnection (connstring); Conn. Open (); stringsql ="SELECT * from Help"; OracleCommand cmd=NewOracleCommand (SQL, conn);intret = cmd. ExecuteNonQuery ();
Oracle database of ADO