Files
CPXV2/SystemX.Net.CP.Platform/SystemX.Net.Platform/SystemX.Common/DataTableQuery.cs
2024-06-26 10:30:00 +09:00

35 lines
955 B
C#

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SystemX.Net.Platform.Common
{
public static class DataTableQuery
{
public static List<DataRow> FindDataRow(DataTable dtTable, string strKeyName, string strFindingValue)
{
List<DataRow> adrResult = (from dtRow in dtTable.AsEnumerable() where dtRow[strKeyName].ToString() == strFindingValue select dtRow).ToList();
return adrResult;
}
public static int GetDataRowHandle(DataTable dtTable, string strKeyFieldName, string strComparingValue)
{
int nIdx = 0;
foreach (DataRow dtRow in dtTable.AsEnumerable())
{
if (dtRow[strKeyFieldName].ToString() == strComparingValue)
return nIdx;
nIdx++;
}
return -1;
}
}
}