1
Answer

How to Display image in datagridview

Ask a question

Hi,

 

i done how to display image from database in  datagridview but problem is its not showing complete image so please help to display full image along with data in datagridview here is my code 

SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=c:\users\vinayak\documents\visual studio 2010\Projects\studentregistery\student.mdf;Integrated Security=True;User Instance=True");

SqlDataAdapter sda = new SqlDataAdapter();

DataTable dt = new DataTable();

DataSet ds = new DataSet();

SqlCommand cmd = new SqlCommand();

sda.SelectCommand =

new SqlCommand("select name,sem,branch,usn from student where reg=" + textBox1.Text, con);

sda.Fill(dt);

/* DataGridViewImageColumn imgcolumn = new DataGridViewImageColumn();

imgcolumn.DataPropertyName = "picture";

imgcolumn.Width = 150;

imgcolumn.HeaderText = "imgogstud";

imgcolumn.ReadOnly = true;

imgcolumn.ImageLayout = DataGridViewImageCellLayout.Normal;

dataGridView1.Columns.Add(imgcolumn);*/

publishimg();

dataGridView1.DataSource = dt;

con.Open();

sda.SelectCommand.ExecuteNonQuery();

con.Close();

v

Answers (1)