日期:2014-05-19  浏览次数:21064 次

datatable小问题,急啊~!!!!!
datatable已知name的值,如何根据该值查询对应的ID值

------解决方案--------------------
DataRow[] rows = Table.Select(String.Format( "name = '{0} ' ", "王 "));
foreach(DataRow row in rows)
{
Console.WriteLine(Convert.Tostring(row[ "id "]));
}
------解决方案--------------------
string txt = e.Node.Text; //获取单击的节点的文本

DataRow[] rows = this.db_Mis_mhDataSet_Pub_CorpInfo.Pub_CorpInfo.Select( "CorpNo DESC ", "CorpName= "+txt); //这行要修改成下面的样子!
int nl = Convert.ToInt32(rows[0][ "CorpNo "]);
this.tbxCorpName.Text = Convert.ToString(nl);

DataRow[] rows = this.db_Mis_mhDataSet_Pub_CorpInfo.Pub_CorpInfo.Select(string.Format( "CorpName= '{0} ' ",txt)); //上面那行要修改成这行的样子。