Pocket pc上开发问题(FrameWork 精简版)
查询出数据FILL到DATASET中
字段1 字段2 字段3
1 a b
2 c d
3 e f
我用dataview过滤
dv.RowFilter = "字段1 ='3'";
dv.Table = ds.Tables[0];
this.dataGrid1.DataSource = dv;
然后dataGrid1显示结果为
字段1 字段2 字段3
3 e f
然后把字段1的值取出来
dv.Table.Rows[this.dataGrid1.CurrentRowIndex]["字段1"].ToString()
但取出来的结果不是3,而是1。
查询出数据FILL到DATASET中
字段1 字段2 字段3
1 a b
2 c d
3 e f
我用dataview过滤
dv.RowFilter = "字段1 ='3'";
dv.Table = ds.Tables[0];
this.dataGrid1.DataSource = dv;
然后dataGrid1显示结果为
字段1 字段2 字段3
3 e f
然后把字段1的值取出来
dv.Table.Rows[this.dataGrid1.CurrentRowIndex]["字段1"].ToString()
但取出来的结果不是3,而是1。
private void MakeDataView()
{
DataView view = new DataView(); view.Table = DataSet1.Tables["Suppliers"];
view.AllowDelete = true;
view.AllowEdit = true;
view.AllowNew = true;
view.RowFilter = "City = 'Berlin'";
view.RowStateFilter = DataViewRowState.ModifiedCurrent;
view.Sort = "CompanyName DESC"; // Simple-bind to a TextBox control
Text1.DataBindings.Add("Text", view, "CompanyName");
}
dv.Table.Rows[this.dataGrid1.CurrentRowIndex]["字段1"].ToString()应该为VB.NET是这样的,C#我语法不太熟,你自己改改啦
dv(dataGrid1.CurrentRowIndex).Row.Item("字段1").ToString()