如何将DataSet数据写入到listview中?

如何将DataSet数据写入到listview中?

/// <summary>
/// 将dataset数据加入listview 中
/// </summary>
/// <param name="_DS"></param>
privatevoidFillList(System.Data.DataSet_DS)
{
lV_Customer_Client.View=System.Windows.Forms.View.Details;

int RowCount=_DS.Tables[0].Rows.Count;
int ColumnCount=_DS.Tables[0].Columns.Count;

//为listview添加columnname
for (int j=0;j<ColumnCount;j++)
{
string ColumnName=_DS.Tables[0].Columns[j].ColumnName;
lV_Customer_Client.Columns.Add(ColumnName,-2,HorizontalAlignment.Left);
}

//循环每一行
for(int i=0;i<RowCount;i++)
{
string itemName=_DS.Tables[0].Rows[i][0].ToString();

ListViewItem item = new ListViewItem(itemName,i);


//循环每一列
for (int j=1;j<ColumnCount;j++)
{
item.SubItems.Add(_DS.Tables[0].Rows[i][j].ToString());

}
boolIsChecked=false;

//根据数据表中的flag字段来表识该行是否被选中
string_Flag=_DS.Tables[0].Rows[i][3].ToString();

if(_Flag.Equals("0"))
{
IsChecked=false;
}
else
{
IsChecked=true;
}

item.Checked= IsChecked;

//将整理好的item加入到listview
lV_Customer_Client.Items.Add(item);
}


}
#endregion

/// <summary>
/// 每一行被check的时候判断 该行是否允许check
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void lV_Customer_Client_ItemCheck(object sender, System.Windows.Forms.ItemCheckEventArgs e)
{

int CurrentItem= e.Index;
CheckStateState;

State=e.NewValue;

if((State==CheckState.Unchecked)&&
(lV_Customer_Client.Items[CurrentItem].SubItems[3].Text=="2"))
{
e.NewValue=e.CurrentValue;
}

}
#endregion