connectionString="Password=czh;User ID=czh;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=
HOST
SERVICE_NAME
User ID
Password
如果oracle數據庫和web在同一台服務器上 可以寫成
connectionString="Password=czh;User ID=czh;Data Source=skydream;"
下面我們要開始查詢數據了
准備工作
A
OracleConnection conn=new OracleConnection(strConn);
conn
string strSql="select * from Table";
OracleDataAdapter da=new Oracle DataAdapter(strSql
DataTable dt=new DataTable();
da
conn
Gridview
Gridview
綁定成功
B
string StrConn=“Data Source=(
DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = *
)
(CONNECT_DATA =
(SERVICE_NAME = 服務名)
)
);
user ID=賬號;Password=密碼;”;
B
Update
OracleConnection conn=new OracleConnection(strConn);
conn
string strSql=“update tabel
or strSql=“insert into table
OracleCommand ocd=new OracleCommand(strSql
int intResult=ocd
conn
讀取查詢oracle數據庫內容
代碼如下 String strSql=“select * from tblproject”;
OracleCommand cmd=new OracleCommand(strSql
OracleDataReader dr=cmd
If(dr
{……}
cmd
dr
conn
在連接過程中我出現過一些問題
當在asp
A 當Oracle
步驟如下
From:http://tw.wingwit.com/Article/program/net/201311/14030.html