Reputation: 2960
I am writing project in ASP. Data Access Layer returns all columns from database table. I want to get value of on specific column and convert it to string.
For example I have
EmployeesTableAdapter eta;
and
eta.getData();
returns "select *from Employees"
query.
How can I get the value of one speific column for example column FirstName?
Upvotes: 0
Views: 1268
Reputation: 6130
Try this:
string FirstName = Convert.ToString(eta.getData().Rows.[0].["FirstName"]);
Upvotes: 2
Reputation: 1610
Assuming you have to use a TableAdapter, use it to fill a DataTable
var dataTable = new DataTable();
EmployeesTableAdapter.Fill(dataTable);
string FirstName = (string)EmployeesTableAdapter.Rows[0][0];
//Rows[0][0] Change appropriately
Upvotes: 1