日期:2014-05-17 浏览次数:20823 次
//以前我写过一个测试的,是没问题的,返回是值的长度而已 protected long GetLength(int id) { OracleConnection conn = null; OracleCommand cmd = null; OracleDataReader dr = null; string sConn = "data source=orcl;user id=zhangandli;password=1;"; try { conn = new OracleConnection(sConn); cmd = new OracleCommand("select b from t where id=1", conn); conn.Open(); dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); if (dr.Read()) { if (dr[0].ToString() != "") { byte[] blob = (byte[])dr[0]; return blob.Length; } } } catch { return 0; } finally { dr.Close(); } return 0; }