我可以将来自 WIQL 的查询绑定到 dataviewer/grid 吗?
Can I bind query from WIQL to dataviewer/grid?
我有将结果输出到文本框的代码
try
{
// Connect to the work item store
TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(
new Uri("xxx"));
WorkItemStore workItemStore = (WorkItemStore)tpc.GetService(typeof(WorkItemStore));
// Run a query.
WorkItemCollection queryResults = workItemStore.Query(richTextBox1.Text);
foreach (WorkItem workItem in queryResults)
{
richTextBox2.Text = string.Join(Environment.NewLine, workItem.AreaPath, workItem.Project);
}
}
catch (Exception exceptionmessage)
{
MessageBox.Show(exceptionmessage.ToString());
}
}
我能否像处理来自 SQL 服务器的 SQL 查询一样处理查询结果并将其绑定到数据网格或数据查看器?我似乎无法让它工作,我不明白数据是如何处理和从 WIQL/TFS 返回的。
不是,你需要获取查询结果并将其放入一个数据集中的table,然后将数据集绑定到datagrid。详情参考这篇文章:
http://blogs.msdn.com/b/briancombs/archive/2006/09/19/762210.aspx
我有将结果输出到文本框的代码
try
{
// Connect to the work item store
TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(
new Uri("xxx"));
WorkItemStore workItemStore = (WorkItemStore)tpc.GetService(typeof(WorkItemStore));
// Run a query.
WorkItemCollection queryResults = workItemStore.Query(richTextBox1.Text);
foreach (WorkItem workItem in queryResults)
{
richTextBox2.Text = string.Join(Environment.NewLine, workItem.AreaPath, workItem.Project);
}
}
catch (Exception exceptionmessage)
{
MessageBox.Show(exceptionmessage.ToString());
}
}
我能否像处理来自 SQL 服务器的 SQL 查询一样处理查询结果并将其绑定到数据网格或数据查看器?我似乎无法让它工作,我不明白数据是如何处理和从 WIQL/TFS 返回的。
不是,你需要获取查询结果并将其放入一个数据集中的table,然后将数据集绑定到datagrid。详情参考这篇文章: http://blogs.msdn.com/b/briancombs/archive/2006/09/19/762210.aspx