http://www.oracle.com/technetwork/topics/dotnet/utilsoft-086879.html
1.
發布時需要包括下面的dll
http://www.189works.com/article-58367-1.html
或者下載oracle ODAC 的xcopy版,運行install.bat all c:\oracle odac 進行安裝
2.
可以使用EF,參數化查詢時使用:paramName
View Code
private void button4_Click(object sender, EventArgs e) { var cmdText=@"select e.empno, e.ename, e.hiredate, d.dname from scott.emp e inner join scott.dept d on e.deptno=d.deptno where d.deptno=:deptno"; var ctx = new Entities(); var list= ctx.ExecuteStoreQuery<EmpInfo>(cmdText,20).ToList(); } } public class EmpInfo { public int EMPNO { get; set; } public string EName { get; set; } public DateTime HireDate { get; set; } public string DName { get; set; } }
3.
串連可以這麼寫:
string connstring = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.30)(PORT=1521)) (CONNECT_DATA=(SID=ORCL)));User Id=scott;Password=password;"
也可以這樣:
string connstring = "Data Source=192.168.1.30:1521/ORCL;User Id=scott;Password=password;"
以管裡員身份登入:
string connstring = "Data Source=192.168.1.30:1521/ORCL;User Id=Sys;Password=admin;DBA Privilege=SYSDBA;";
4.
使用 Oracle Net Configuration Assistant 可以配置Oracle串連連接埠,老連不上的話,可以用這個試試