Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

LINQ query on a DataTable C#

var results = from myRow in myDataTable.AsEnumerable()
where myRow.Field<int>("RowNo") == 1
select myRow;
Comment

linq datatable

//Reference System.Data.DataSetExtensions
//Be carefull to data types
int id = 1;
//one row
DataRow r = (from DataRow m in myTable.Rows where m.Field<int>("col_name") == id select m).FirstOrDefault();
//list of rows
List<DataRow> r = (from DataRow m in myTable.Rows where m.Field<int>("col_name") == id select m).ToList();
Comment

PREVIOUS NEXT
Code Example
Csharp :: unity gui style color button 
Csharp :: stringbuilder to string c# 
Csharp :: how to get a length of a string in c# 
Csharp :: c# regex find last match 
Csharp :: c# html to pdf 
Csharp :: how to add to a list only items that are not already in the list c# 
Csharp :: how to skip bin/Debug/netcoreapp3.1/ on the reltaive path 
Csharp :: first person mouse look unity 
Csharp :: what is void onmousedown() 
Csharp :: Sort ListBox numerically in C# 
Csharp :: c# loop xml 
Csharp :: what value of combobox index c# 
Csharp :: difference between awake and start unity 
Csharp :: run file windows forms 
Csharp :: unity gameobject find inactive 
Csharp :: linq to json 
Csharp :: how to trim path in C# 
Csharp :: c# nullable generic 
Csharp :: get device name c# console 
Csharp :: unity lerp 
Csharp :: window height in C# forms 
Csharp :: change line color in c# 
Csharp :: sieve of eratosthenes 
Csharp :: audiosource unity 
Csharp :: C# linq mselect 
Csharp :: loop for x amount of seconds c# 
Csharp :: c# const 
Csharp :: generate UUID id for my entities 
Csharp :: c# read excel file into datatable 
Csharp :: How to make enemy shooting 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =