Click here to Skip to main content
15,939,243 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Comments
Kornfeld Eliyahu Peter 11-Jun-14 5:26am    
"but i can't" - it's a very poor declaration of your problem. You should be more specific, an error maybe!?

1 solution

It's not exactly difficult:
C#
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...
 
Share this answer
 
Comments
Naveen Kumar Malli 11-Jun-14 23:55pm    
actually i do binding code to datagridview...but the thing is images are not binding to my datagridview...the image column was showing an break image symbol(default image symbol)...how to bind my varbinary(max) to datagridview.....i would be so thank full it i have an answer for this...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900