ADO.Net對oracle數(shù)據(jù)庫操作的實(shí)例代碼
首先要寫連接字符串
可以在web.config里寫上
<connectionStrings>
<add name="oracleson" connectionString="Data Source=dingsenorcl;Persist Security Info=True;User ID=ds;Password=ds;Unicode=True" providerName="System.Data.OracleClient"/>
</connectionStrings>
<connectionStrings>
<add name="oracleson" connectionString="Data Source=dingsenorcl;Persist Security Info=True;User ID=ds;Password=ds;Unicode=True" providerName="System.Data.OracleClient"/>
</connectionStrings>
然后再后臺調(diào)用
string orclcon = ConfigurationManager.ConnectionStrings["oracleson"].ConnectionString;
string orclcon = ConfigurationManager.ConnectionStrings["oracleson"].ConnectionString;
然后要新建一個(gè)數(shù)據(jù)庫連接對象
OracleConnection conn = new OracleConnection(orclcon)
OracleConnection conn = new OracleConnection(orclcon)
創(chuàng)建一個(gè)OracleCommand對象來對數(shù)據(jù)庫進(jìn)行操作
OracleCommand cmd = conn.CreateCommand()
OracleCommand cmd = conn.CreateCommand()打開連接
conn.Open();操作就行了
cmd.CommandText = "insert into T_12(AAAA)values(:a)";
cmd.Parameters.AddWithValue(":a", TextBox1.Text); //參數(shù)替換oracle數(shù)據(jù)庫要用: sqlserver數(shù)據(jù)庫是@
cmd.ExecuteNonQuery();
cmd.CommandText = "insert into T_12(AAAA)values(:a)";
cmd.Parameters.AddWithValue(":a", TextBox1.Text); //參數(shù)替換oracle數(shù)據(jù)庫要用: sqlserver數(shù)據(jù)庫是@
cmd.ExecuteNonQuery();
- C#利用ODP.net連接Oracle數(shù)據(jù)庫的操作方法
- .Net連接Oracle數(shù)據(jù)庫的實(shí)現(xiàn)代碼
- .net實(shí)現(xiàn)oracle數(shù)據(jù)庫中獲取新插入數(shù)據(jù)的id的方法
- .net連接oracle的3種實(shí)現(xiàn)方法
- asp.net中調(diào)用oracle存儲過程的方法
- Ibatis.net結(jié)合oracle批量刪除實(shí)現(xiàn)代碼
- asp.net中oracle 存儲過程(圖文)
- 在.NetCore(C#)中使用ODP.NET Core+Dapper操作Oracle數(shù)據(jù)庫
相關(guān)文章
asp.net實(shí)現(xiàn)的DES加密解密操作示例
這篇文章主要介紹了asp.net實(shí)現(xiàn)的DES加密解密操作,結(jié)合具體實(shí)例形式分析了asp.net實(shí)現(xiàn)DES加密與解密算法的實(shí)現(xiàn)技巧,需要的朋友可以參考下2017-07-07
asp.net實(shí)現(xiàn)中英文多域名檢測的方法
這篇文章主要介紹了asp.net實(shí)現(xiàn)中英文多域名檢測的方法,涉及asp.net針對URL中域名的解析及字符串操作相關(guān)技巧,需要的朋友可以參考下2016-08-08
Asp.Net Core WebAPI使用Swagger時(shí)API隱藏和分組詳解
這篇文章主要給大家介紹了關(guān)于Asp.Net Core WebAPI使用Swagger時(shí)API隱藏和分組的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家學(xué)習(xí)或者使用Asp.Net Core具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧2019-04-04
ASP.NET 根據(jù)漢字獲取漢字拼音的首字母(含多音字)
本文分享了一個(gè)函數(shù),這個(gè)函數(shù)可以根據(jù)漢字的字符串獲取其拼音的首字母,以便我們在實(shí)際開發(fā)中使用。2016-04-04
.Net讀取Excel 返回DataTable實(shí)例代碼
這篇文章主要介紹了.Net讀取Excel 返回DataTable實(shí)例代碼,有需要的朋友可以參考一下2014-01-01

