如何使用来自SQL Server的图像的数据填充datagridview [英] How to populate datagridview with data with images from SQL Server

查看:80
本文介绍了如何使用来自SQL Server的图像的数据填充datagridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好b $ b

我已经阅读了很多关于这个问题的文章。但没有得到正确的答案或者可能是我无法理解。



我有一张桌子,将收据编号,批号和收据副本存储为数据库中的图像



for ex:Referenceid:int

batchnumber:int

收据压缩:图片



我是尝试在datagridview中显示这些数据。



Hi
I've gone through many articles about this issue. But didn't get a proper answer or may be I'm not able to understand.

I've a table which stores receipt number, batch numbers and a copy of receipt as image in database

for ex: Referenceid : int
batchnumber : int
receiptcompressed : image

I'm trying display this data in datagridview.

Dim sqlString As String
     'Dim cmd As SqlCommand
     Dim storeID As String
     Dim saleDate As String
     Dim ds As DataSet

     With DataGridView1
         storeID = .CurrentRow.Cells(1).Value
         saleDate = .CurrentRow.Cells(2).Value
     End With

     sqlString = "select batchnumber, [time],ReceiptCompressed from Journal where TransactionType=16 and StoreId ='" & storeID & "'" & _
                     "  and [Time] between '" & saleDate & " 00:00:00' and '" & saleDate & " 23:59:59'"




     ds = getDataset(connectionString, sqlString)

     DataGridView2.DataSource = ds.Tables(0)









加载数据时出现问题。



datagridview中出现以下错误



system.argumentexception.image.fromstream(系统系统,布尔值useembeddedcolormanagement, boolean validateimagedataetc .....





谁能告诉我最简单的方法是什么?如上所述存储的数据在表中我想加载到datagridview和图像。



谢谢

Venkat





Problem is an error is coming while loading the data.

"The following error occured in the datagridview

system.argumentexception.image.fromstream(system system, boolean useembeddedcolormanagement, boolean validateimagedata " etc.....


Can anyone tell me what is the simplest way to do this? As mentioned data stored in table I want to load into datagridview along with image.

Thanks
Venkat

推荐答案

试试这些链接 -



将图像添加到C#D ataGridView
[ ^ ]

DataGridView中的图像缩略图预览 [< a href =http://www.codeproject.com/Articles/29383/Image-Thumbnail-Preview-in havenGridViewtarget =_ blanktitle =New Window> ^ ]

DataGridViewImageColumn.Image Property [ ^ ]
Try these links -

Add Image to C# DataGridView
[^]
Image Thumbnail Preview in DataGridView[^]
DataGridViewImageColumn.Image Property[^]


我已经尝试但是没有用完。
I've tried but it's not working out.


这篇关于如何使用来自SQL Server的图像的数据填充datagridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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