ORACLE中存取字節以上大文本類型可以用此數據類型其在C#中的讀寫方法如下
注意需要引用 SystemDataOracleClient
然後添加命名空間using SystemDataOracleClient
ORALCE建庫腳本
CREATE TABLE TEST
(
AGREEMENT_ID CHAR() NOT NULL
AGREEMENT_CONTENT LONG NULL
)
插入數據
protected void Button_Click(object sender EventArgs e)
{
OracleConnection conn = new OracleConnection(@Password=XXXXXX;User ID=hk;Data Source=wealth;Persist Security Info=True);
connOpen();
OracleCommand cmd = new OracleCommand(Select * From TEST conn);
string sql = Insert Into TEST (AGREEMENT_ID AGREEMENT_CONTENT) Values(:P_ID :P_Value);
cmdCommandText = sql;
cmdParametersAdd(P_ID thisTextBoxText);
cmdParametersAdd(P_Value thisTextBoxText);
cmdExecuteNonQuery();
connClose();
}
讀取數據
protected void Button_Click(object sender EventArgs e)
{
OracleConnection conn = new OracleConnection(@Password=XXXXXX;User ID=hk;Data Source=wealth;Persist Security Info=True);
connOpen();
string sql = Select * From TEST where AGREEMENT_ID = :P_ID;
OracleDataAdapter da = new OracleDataAdapter(sql conn);
daSelectCommandParametersAdd(P_ID thisTextBoxText);
DataSet ds = new DataSet();
daFill(ds);
thisTextBoxText = dsTables[]RowsCountToString();
thisTextBoxText = dsTables[]Rows[][AGREEMENT_CONTENT]ToString();
connClose();
}
From:http://tw.wingwit.com/Article/program/Oracle/201311/18871.html