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 :: shut game unity 
Csharp :: C# unit test exception using attribrute 
Csharp :: set file to read only C# 
Csharp :: unity list get item at index 
Csharp :: how to keep rigidbody2D upright unity 
Csharp :: string to array c# 
Csharp :: c# export datatatble to excel 
Csharp :: c# goto statement 
Csharp :: c# loop string 
Csharp :: add list to list c# 
Csharp :: how to redirect to another page in button clicked in asp.net c# index.cshtml 
Csharp :: HTTP Error 500.35 - ASP.NET Core does not support multiple apps in the same app pool 
Csharp :: C# loop through the registry searching for keys containing 
Csharp :: euler to quaternion 
Csharp :: c# tab select tab 
Csharp :: loop for specific time c# 
Csharp :: c# null conditional 
Csharp :: csharp Console.Read(); 
Csharp :: context.Response.Body read stream .net 
Csharp :: C# Blocks with statements 
Csharp :: cross thread exception in c# control 
Csharp :: Options Pattern startup.cs configuration 
Csharp :: C# ValidationAttribute required when 
Csharp :: unity collision.impulse 
Csharp :: How to decode Microsoft Local token in service 
Csharp :: referans tipi nedir c# 
Csharp :: unity2d switch camera 
Csharp :: c# how to get a file path from user 
Csharp :: instantiate an array in c# 
Csharp :: if statement in razor using "?" and ":" 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =