I'm getting the data of my Datatable into a List but i need to get only the items of a matching date how can i do a Linq statement of my datatable to filter the data on the provided date? My table Structure is taken from a stored procedure
This is my Code:
System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand("JoinedRecords", conn);
cmd.CommandType = CommandType.StoredProcedure;
conn.Open();
DataTable myTable = new DataTable();
myTable.Load(cmd.ExecuteReader());
conn.Close();
for (var rowIndex = 0; rowIndex < myTable.Rows.Count; rowIndex++)
{
var row = myTable.Rows[rowIndex];
var rowValues = new List<string>();
foreach (DataColumn column in myTable.Columns)//Where column.Date.Day == 3
{
rowValues.Add(row[column].ToString());
}
var jsonRow = JsonConvert.SerializeObject(rowValues);
// Write current row
reader.Write(jsonRow);
// Add separating comma
if (rowIndex != myTable.Rows.Count - 1)
reader.WriteLine(",");
} How can i do this? There a data in my datatable that has datetime format