zoukankan      html  css  js  c++  java
  • 关于从Image字段读取图片流并显示在PictureBox控件时报‘参数无效’异常的解决方法

        问题出在存储图片信息的代码中,SqlParameter构造函数中的[Size]参数不是Image字段的长度(16),而是字节数组的长度。 可用一下两种构造方式构造SqlParameter

        SqlParameter para = new SqlParameter("@ImageCol", SqlDbType.Image, bytes.Length, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, bytes);

      或 SqlParameter para = new SqlParameter("@ImageCol", SqlDbType.Image,bytes.Length);
                    para.Value = bytes;

    Code

    二。读取图片信息

    Code
  • 相关阅读:
    【Python】在控制台输出不同颜色的文字
    【python】如何去掉使用BeautifulSoup读取html出现的警告UserWarning: You provided Unicode markup but also provided a value for from_encoding
    【nodejs】修改了下对股票表进行crud操作的代码
    【nodejs】用express又做了份crud
    day20_day23课堂笔记
    Myeclipse中java web.xml报错cvc-complex-type.2.3: Element 'web-app' cannot have character [children], because the type's content type is element- only.
    html中让input标签只读不可编辑的方法
    Win10锁屏壁纸位置在哪? 默认锁屏壁纸怎么提取?
    Potplayer怎么实现视频的镜面翻转?
    How to export Excel files in a Python/Django application
  • 原文地址:https://www.cnblogs.com/gossip/p/1505953.html
Copyright © 2011-2022 走看看