Hi nauna,
I have created sample thet full fill your requirement. You need to chenge your code as per the sample.
Code
string minPrice = "100";
string maxPrice = "200";
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[3] { new DataColumn("Id", typeof(int)), new DataColumn("Name"), new DataColumn("SalePrice", typeof(int)) });
dt.Rows.Add(1, "Chai", 100);
dt.Rows.Add(2, "Chang", 150);
dt.Rows.Add(3, "Aniseed Syrup", 300);
dt.Rows.Add(4, "Ikura", 200);
DataTable result = dt.AsEnumerable().Where(row => row.Field<int>("SalePrice") >= int.Parse(minPrice) && row.Field<int>("SalePrice") <= int.Parse(maxPrice)).CopyToDataTable();
//Or
//DataTable result = dt.Select(String.Format("SalePrice >= {0} AND SalePrice <= {1}", int.Parse(minPrice), int.Parse(maxPrice))).CopyToDataTable();
OutPut
Id |
Name |
SalePrice |
1 |
Chai |
100 |
2 |
Chang |
150 |
4 |
Ikura |
200 |