使用IntPtr在C#中的SQL 2005中插入图像 [英] Inserting Images in SQL 2005 in C# using IntPtr

查看:96
本文介绍了使用IntPtr在C#中的SQL 2005中插入图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题很简单,我使用 WIA 或5 TWAIN 扫描图像,然后以IntPtr的形式获取图像,我想将此图像插入数据库中?

Hi, my question is simple, I scan images using WIA or5 TWAIN and I get the image in the form of IntPtr I want to insert this image in the database?

推荐答案

您需要将非托管指针转换为托管字节数组:Marshal.Copy [ ^ ]是您所需要的.但是首先,您需要找到IntPtr指向的图像缓冲区的大小,并分配足够大的byte [].没有您的代码,我无法告诉您如何获得该代码! :laugh:
You need to convert the unmanaged pointer to a managed array of bytes: Marshal.Copy[^] is what you need. But first, you need to find the size of the image buffer that the IntPtr points to, and allocate a big enough byte[]. Without your code, I can''t tell you how to get that! :laugh:


这篇关于使用IntPtr在C#中的SQL 2005中插入图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆