我必须创建一个窗口表单,将MySQL表绑定到DataGridView,我的DataGridView看起来像这样
func (b *Buffer) Read(p []byte) (n int, err error)
func (sh serverHandler) ServeHTTP(rw ResponseWriter, req *Request)
func (r Rectangle) Size() Point
使用此代码
ID Name PIC
1 Leo 64BaseStringImage
2 hello 64BaseStringImage
是否可以使DataGridView成为这个?
mcon.Open();
MySqlDataAdapter MyDA = new MySqlDataAdapter();
string sqlSelectAll = "SELECT id,name,pic from stockitem ORDER BY id ASC, name ASC";
MyDA.SelectCommand = new MySqlCommand(sqlSelectAll, mcon);
DataTable table = new DataTable();
MyDA.Fill(table);
BindingSource bSource = new BindingSource();
bSource.DataSource = table;
this.dataGridView1.DataSource = bSource;
DataGridViewColumn column = dataGridView1.Columns[2];
column.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
//dataGridView1.DataBindings.Add("Image", mbsPrimario, "PICFIELD", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
mcon.Close();
我用它来解码图片和成功
ID Name PIC
1 Leo Image
2 Hello Image
但我不知道如何获取每个字符串图像,解码它然后插回数据源。
答案 0 :(得分:2)
显示字符串到图像的方式是这样的,
class MyClass {}
struct MyStruct {}
let newStruct = typeFromName("MyStruct").init()
let newClass = typeFromName("MyClass").init()