0

I'm tired of searching and I can't figure out. Probably this isn't possible.

string query = "SELECT cust.id, cust.name, cust.photo, country.description
                FROM customers AS cust
                INNER JOIN countries AS country ON country.id = cust.id_country"

/* etc.. command ..*/
DataSet ds = new DataSet();
da.Fill(ds, "customers");

Ok, after doing this I disable the AutoGenerateColumns, I do set the DataSource and finally I create the columns by hand.

this.dataGridView1.AutoGenerateColumns = false;
this.dataGridView1.DataSource = ds.Tables["customers"];

var _name = new DataGridViewTextBoxColumn() { 
    HeaderText = "Name",
    DataPropertyName = "name"
};
var _photo = new DataGridViewImageColumn() { 
    HeaderText = "",
    Image = new Bitmap(Application.StartupPath + "/customers/" + ????????)
};

So, my problem is on the "???" characters. How do I set in that place the cust.photo field? The cust.photo retrieves the name of the photo, something like "ske_213f.jpg"

pravprab
  • 2,301
  • 3
  • 26
  • 43
Linesofcode
  • 5,327
  • 13
  • 62
  • 116

0 Answers0