标签:winform 数据 for ar new sql type 学习
进入日进的第一周,主要是做winform相关的内容,这次权当复习下,下面做一下这一周的笔记。
1. Combobox关联数据源DataTable
a. 自定义DataTable内容
var dataTable = new DataTable(){};
dataTable.Columns.Add("IdCard", typeof (String));
dataTable.Columns.Add("Name", typeof (String));
var row = dataTable.NewRow();
row["IdCard"] = "123";
row["Name"] = "Lacus";
dataTable.Rows.Add(row);
dataTable.Rows.InsertAt(dataTable.NewRow(),0);
this.comboboxPeople.DataSource = dataTable;
this.comboboxPeople.DisplayMember = "Name";
this.comboboxPeople.ValueMeber = "IdCard";
b. 通过Adapter
var dataTable=new DataTable();
var adapter=new DataAdapter();
adapter.SelectCommand=sqlCommand;
adapter.Fill(dataTable);
标签:winform 数据 for ar new sql type 学习
原文地址:http://www.cnblogs.com/aeolia/p/3899395.html