Click here to Skip to main content
14,698,201 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
i was designed a table like userdetails in this the fields are userid,userimg,username how can i display all the fields in a gridview ,i can't display the image in a gridview,
pls any one can tell me the solution.


Thank u
Posted
Comments
Sandeep Mewara 28-Mar-11 3:34am
   
This is a very straight thing and discussed many times over here. Did you try to even search? Google will give lots of links.

Try, and share your effort if you are unable to with the error/issue. We will surely help.

There is a good tutorial on MSDN[^] which should help...

Try Google next time: I found this as the first link in a simple search: "display the image in a gridview" pasted from your question...

Google can save you a lot of time, as opposed to asking a question!
   
con1 = new SqlConnection();
                con1.ConnectionString = @"Data Source=KOL-00D55-SRVMR\SRVMRSQL2005;Initial Catalog=AdventureWorks;User ID=student";
                con1.Open();
                SqlCommand sqlquery = new SqlCommand("SELECT pic FROM imagetable WHERE id =1", con1);
                SqlDataAdapter da = new SqlDataAdapter(sqlquery);
                DataSet ds = new DataSet();
                da.Fill(ds);
                //if (dr.Read())
                //{
              
                //ms.re
                    byte[] arr=new byte[0];
                arr=(byte[])ds.Tables[0].Rows[0][0];
                MemoryStream ms = new MemoryStream(arr);
                pictureBox1.Image = Image.FromStream(ms);
                //Image str;


http://support.microsoft.com/kb/317701[^]
   
Hope this[^] might help you.
   
   

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