网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

c#读取个人签名到内存

//
         //方法功能:读取个人签名到内存
         //
         //
         //
         //
        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;
        }

网页题目:c#读取个人签名到内存
浏览地址:http://bjjierui.cn/article/iehoio.html

其他资讯