//<summary> //<newpara>方法功能:讀取個(gè)人簽名到內(nèi)存</newpara> //</summary> //<param name="vMarkName"></param> //<param name="vPassWord"></param> //<returns></returns> private byte[] LoadMarkImage(string szSql) { //bool mResult = false; byte[] m_bytFileBody = null; System.IO.MemoryStream oStream = null; System.IO.BinaryWriter oWriter = null; try { //string szSelectCmd = "SELECT c.MarkBody FROM OA_ESignature c where c.CO='XF01' and c.UserId='" + userid + "'"; //if (m_oDbHelper == null) //{ // m_oDbHelper = new DbHelper(); //} //m_oDbHelper.OpenDbResource(); DbCommand mCommand = m_oDbHelper.CreateDbCommand(); mCommand.CommandType = CommandType.Text; mCommand.CommandText = szSql; IDataReader oReader = mCommand.ExecuteReader(System.Data.CommandBehavior.SequentialAccess); // LogCentral.CurrentLogger.LogInfo(); if (oReader.Read()) { if (!oReader.IsDBNull(0)) { int bufferSize = 500; // Size of the BLOB buffer. byte[] outbyte = new byte[bufferSize]; // The BLOB byte[] buffer to be filled by GetBytes. long retval; // The bytes returned from GetBytes. long startIndex = 0; // The starting position in the BLOB output. // Get ACL By BLOB ColumnType oStream = new System.IO.MemoryStream(); oWriter = new System.IO.BinaryWriter(oStream, System.Text.Encoding.UTF8); startIndex = 0; retval = oReader.GetBytes(0, startIndex, outbyte, 0, bufferSize); //ItemACL // Continue reading and writing while there are bytes beyond the size of the buffer. while (retval == bufferSize) { oWriter.Write(outbyte); oWriter.Flush(); startIndex += bufferSize; retval = oReader.GetBytes(0, startIndex, outbyte, 0, bufferSize); //ItemACL } // Write the remaining buffer. oWriter.Write(outbyte, 0, (int)retval); } //m_szFileType = oReader.GetString(1).ToString(); // mResult = true; } //else //{ // mResult = false; //} oReader.Close(); oReader = null; m_bytFileBody = oStream.GetBuffer(); //LogCentral.CurrentLogger.LogInfo("m_bytFileBody:" + m_bytFileBody.ToString()); LogCentral.CurrentLogger.LogInfo("m_bytFileBody:" + m_bytFileBody.Length); } catch (Exception e) { LogCentral.CurrentLogger.LogInfo(e.ToString()); //mResult = false; } finally { //m_oDbHelper.CloseDbResource(); try { if (oWriter != null) { oWriter.Flush(); oWriter.Close(); } } catch { } try { if (oStream != null) oStream.Close(); } catch { } } return m_bytFileBody; }
文章標(biāo)題:c#讀取個(gè)人簽名到內(nèi)存
本文網(wǎng)址:http://jinyejixie.com/article0/iehoio.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供動(dòng)態(tài)網(wǎng)站、、品牌網(wǎng)站建設(shè)、建站公司、關(guān)鍵詞優(yōu)化、網(wǎng)站設(shè)計(jì)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)