感谢网友 时空盲盒 提供的代码:
import console;
import dotNet;
thispath = io.appData('aar\Oracle.ManagedDataAccess.dll',$'\Oracle.ManagedDataAccess\Oracle.ManagedDataAccess.dll')
var getConn =function(){
dotNet.reference({
["Oracle.ManagedDataAccess"]=thispath;
})
dotNet.import("Oracle.ManagedDataAccess");
dotNet.import("Oracle.ManagedDataAccess.Client");
odp = Oracle.ManagedDataAccess.Client
var IP = '*.*.*.*'
var user = '****'
var pwd = '****'
var svrname = '****'
var connString = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST="+IP+")(PORT=1521))(CONNECT_DATA=(SERVICE_NAME="+svrname+")));Persist Security Info=True;User ID="+user+";Password="+pwd+";";
conn =odp.OracleConnection(connString);
conn.Open();
return conn;
}
var query_ret_temp = function(getsql){
getConn()
var sql = getsql
cmd = conn.CreateCommand()
cmd.CommandText = sql;
adapter = odp.OracleDataAdapter(cmd);
dt_ry = System.Data.DataTable();
ds_ry = adapter.Fill(dt_ry);
adapter.Dispose();
return dt_ry;
}
var sql ="select * from *** "
var rst = query_ret_temp(sql)
console.pause(true);