I have a Strongly typed Dataset TableAdapter in C#, how do I get a single row from it?
+1
A:
var table = tableAdapter.GetData();
var resultRow = table.Rows[0];
EDIT: Strongly-typed datasets create a property for each column in the table, so to get the Id, this should work:
int id = resultRow.Id
You can also get fields by name:
int id = (int)resultRow["id"];
Lee
2010-06-27 15:51:26
how can i get for example only the ID value from this row
drorhan
2010-06-27 16:04:20
@Lee var table = tableAdapter.GetData();var resultRow = table.Rows[0];i get the field name with this.
drorhan
2010-06-27 16:12:02
i can not get the field list in this way
drorhan
2010-06-27 17:12:06
yes this works. thank you
drorhan
2010-06-27 22:38:06
A:
var ta = new AddressTableAdapter();
var ret = ta.GetDataBy(Convert.ToInt32(ASPxTextBox1.Text));
var rw = ret.Rows[0];
var city = (string)rw["City"];
ASPxTextBox2.Text = city.ToString();
drorhan
2010-06-27 22:41:31