小弟我在毕业设计时又遇到问题了
我用dataGridView手动绑定DATASET时出现一个问题:
数据类型为int的项都没法显示
我用的开发工具为VS2005,数据库为MYSQL
代码为:
book_manage_dataGridView.AutoGenerateColumns = false;
his.salenum.DataPropertyName = "book_sale_num";
this.salenum.FillWeight = 70F;
this.salenum.HeaderText = "销售量";
this.salenum.Name = "salenum";
this.salenum.ReadOnly = true;
this.salenum.Width = 70;
绑定string是成功的:
ds = book.book_selectall(1,"");
book_manage_dataGridView.DataSource = ds.Tables["book"].DefaultView;
我用dataGridView手动绑定DATASET时出现一个问题:
数据类型为int的项都没法显示
我用的开发工具为VS2005,数据库为MYSQL
代码为:
book_manage_dataGridView.AutoGenerateColumns = false;
his.salenum.DataPropertyName = "book_sale_num";
this.salenum.FillWeight = 70F;
this.salenum.HeaderText = "销售量";
this.salenum.Name = "salenum";
this.salenum.ReadOnly = true;
this.salenum.Width = 70;
绑定string是成功的:
ds = book.book_selectall(1,"");
book_manage_dataGridView.DataSource = ds.Tables["book"].DefaultView;
建议你使用窗口设计器设计DataGridView的数据源和字段的Style,这才是开发工具推荐的方法,不建议你用手写代码来设置DataGridView的数据源及字段。
你再试试,如果连int类型都不能显示,那.net还做个屁啊!