var tbUnion = dtSame.AsEnumerable()
.Union(dtSmaller.AsEnumerable());
DataTable unionTable = tbUnion.CopyToDataTable();
.Union(dtSmaller.AsEnumerable());
DataTable unionTable = tbUnion.CopyToDataTable();
C# | MVC | DotnetCore | Web API | Blazor | HTML | BootStrap | JavaScript | JQuery | EF | Angular | SQL | Azure
private DateTime ConvertToDateTime(string strDateTime)
{
DateTime dtFinaldate; string sDateTime;
try { dtFinaldate = Convert.ToDateTime(strDateTime); }
catch (Exception e)
{
string[] sDate = strDateTime.Split('/');
sDateTime = sDate[1] + '/' + sDate[0] + '/' + sDate[2];
dtFinaldate = Convert.ToDateTime(sDateTime);
}
return dtFinaldate;
}
switch (value)
{
case 1:
case 2:
//write your code
break;
case 3:
case 4: case 5: case 6:
//write your code
break;
default:
//write your code
break;
}
string[] stringArray = { "India ", "great ", "country ","in", "
this " "world" };
var last=stringArray.Last();
var first=stringArray.First();
//Changing the row color as per the Stream Value | ||||||||||
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) | ||||||||||
{ | ||||||||||
string strA= dataGridView1.CurrentRow.Cells["ColA"].Value.ToString(); | ||||||||||
strA= strA.Trim(); | ||||||||||
if (strA.Equals("India")) | ||||||||||
{ | ||||||||||
dataGridView1.CurrentRow.DefaultCellStyle.BackColor = Color.LightSkyBlue; | ||||||||||
} | ||||||||||
else if (strA.Equals("PAK")) | ||||||||||
{ | ||||||||||
dataGridView1.CurrentRow.DefaultCellStyle.BackColor = Color.GreenYellow; | ||||||||||
} | ||||||||||
else if (strA.Equals("USA")) | ||||||||||
{ | ||||||||||
dataGridView1.CurrentRow.DefaultCellStyle.BackColor = Color.OrangeRed; | ||||||||||
} | ||||||||||
else if (stream.Equals("")) | ||||||||||
{ | ||||||||||
dataGridView1.CurrentRow.DefaultCellStyle.BackColor = Color.White; | ||||||||||
} | ||||||||||
} |
foreach (DataRow rowSec in ud.m_UsertestGroupsTable.Rows) { if( (bool)rowSec["ColumnName"] == true) // or if((bool)rowSec[columnIndex] == true) { //do something. }
I suggest you Please not use index, prefer to Column Name
foreach(DataRow drow in dt.Rows) { string value = drow[columnname].ToString(); }