0

我的问题是dtJoin结果datagrid与选择查询列顺序不同。

Address先显示字段,然后ClientCdClientName显示MemberCd

我不知道它按列名顺序显示结果的原因?

我的代码是

Dim dtClient As DataTable
dtClient = getDataTable_sql(SqlStr, SQLCnn)
dtJoin = (From C In dtClient Select C!MemberCd, C!ClientCd, C!Address, C!ClientName).ToList
DataGridView1.DataSource = dtJoin

请任何人帮助我

4

1 回答 1

0

在重新加载数据源之前设置为DataSourceDataGridView1Nothing

Dim dtClient As DataTable
dtClient = getDataTable_sql(SqlStr, SQLCnn)
dtJoin = (From C In dtClient Select C!MemberCd, C!ClientCd, C!Address, C!ClientName).ToList
'-------------------
DataGridView1.DataSource = Nothing
'-------------------
DataGridView1.DataSource = dtJoin
于 2013-07-10T12:48:15.900 回答