如何将varbinary(max)映像绑定到WinForms中的datagridview [英] How to Bind The varbinary(max) image to my datagridview in WinForms

查看:127
本文介绍了如何将varbinary(max)映像绑定到WinForms中的datagridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为 Studentimage 的表,其中列为 Stu id int,Image varbinary(max ),我正在试图将我的图像列绑定到datagridview但是我不能......可以提出任何建议,以实现这个任务

I have a Table with name of Studentimage with columns of Stu id int,Image varbinary(max),i am triying to bind my image column to datagridview but i can't ...could any suggestions,,, to achieve this task

推荐答案

这并不困难:

It's not exactly difficult:
string sql = "SELECT TOP 10 Id, Thumbnail FROM Images";
using (SqlConnection con = new SqlConnection(strConnect))
    {
    con.Open();
    using (SqlDataAdapter da = new SqlDataAdapter(sql, con))
        {
        DataTable dt = new DataTable();
        da.Fill(dt);
        myDataGridView.DataSource = dt;
        }
    }

为我工作......

Works for me...


这篇关于如何将varbinary(max)映像绑定到WinForms中的datagridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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