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();
}