SqlCommand comm = new SqlCommand(); byte[] bt; try { comm.CommandText = "select * from tblusers where uname=@uname"; comm.Connection = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString); comm.CommandType = CommandType.Text; comm.Parameters.AddWithValue("@uname", TextBox1.Text); comm.Connection.Open(); if (comm.Connection.State == ConnectionState.Open) { SqlDataReader dr = comm.ExecuteReader(); if (dr.HasRows) { dr.Read(); bt = ((byte[])dr["profilePic"]); Response.BinaryWrite(bt); } } } catch (Exception ex) { throw; }
John Bhatt Glad to Know, Free to Share..... http://www.johnbhatt.com
Login to post response