0

我厌倦了搜索,我无法弄清楚。恐怕这是不可能的。

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");

好的,在这样做之后我禁用了AutoGenerateColumns,我设置了DataSource,最后我手动创建了列。

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/" + ????????)
};

所以,我的问题是在“???” 人物。我如何在那个地方设置cust.photo字段?检索照片的cust.photo名称,例如"ske_213f.jpg"

4

0 回答 0