Answer the question
In order to leave comments, you need to log in
How to get data from DataSet?
In vain I try to receive the data from the connected DataSet. Connected the database through Data Sources, the data is successfully added to the database through the TableAdapter. Now I want to take data from this database through DataSet using LINQ. But on the Internet, all examples begin with the fact that the DataSet is created and filled just before taking data from it, for example:
StudentDataSet studentDataSet = new StudentDataSet();
studentDataSet.Students.AddStudentsRow(1, "Александр Ерохин");
studentDataSet.Students.AddStudentsRow(7, "Елена Волкова");
studentDataSet.Students.AddStudentsRow(13, "Дмитрий Моисеенко");
studentDataSet.Students.AddStudentsRow(72, "Андрей Мухамедшин");
string name =
studentDataSet.Students.Where(student => student.Id == 7).Single().Name;
Console.WriteLine(name);
And how to take the data from already existing DataSet? After all, it is natural that when I create new DataSet(), there will be no data in it, and the next query will create an empty DataSet, and then look for something in it:var ds = new masterDataSet();
var lotTable = ds.LOTS;
IEnumerable<DataRow> query =
from lot in lotTable.AsEnumerable()
select lot;
That is, it seems to me that something likevar ds = masterDataSet.GetCurrent();
Answer the question
In order to leave comments, you need to log in
The dataset has a collection of Tables (DataTableCollection type), iterate over them.
Everything is in MSDN. Awesome stuff, I'll tell you ;)
msdn.microsoft.com/ru-ru/library/system.data.datas...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question