-1
我已经创建了一个数据表用户输入从数据表中检索数据:如何基于
DataTable dt=new DataTable();
dt.Columns.Add("Country", typeof(string))
dt.Columns.Add("place", typeof(string))
dt.Columns.Add("Price", typeof(string))
dt.Columns.Add("Desc", typeof(string))
,我已经在这个数据表中插入一些数据:
DataRow dtrow = dt.NewRow(); // Create New Row
dtrow["Country"] = "India"; //Bind Data to Columns
dtrow["place"] = "wizag";
dtrow["Price"] = "7520";
dtrow["Desc"] = "Anywhere";
dt.Rows.Add(dtrow);
dtrow = dt.NewRow(); // Create New Row
dtrow["Country"] = "India"; //Bind Data to Columns
dtrow["place"] = "Goa";
dtrow["price"] = "4500";
dtrow["Desc"] = "Anything";
dt.Rows.Add(dtrow);
我已经绑定这个数据表与我的网格视图。我还在mmy aspx页面中添加了一个文本框和一个搜索按钮。我的要求是我想根据用户输入搜索数据,例如4500或wizag,如果国家名称相同,我想将它显示在一行中
我该怎么做?
尝试使用
DataView
https://mva.microsoft.com/en-us/training-courses/introduction-to-asp-net-mvc-8322或获得关于asp.net的一本不错的书 – BugFinder如果你向我们展示你的尝试,并描述你遇到的问题,你很可能会得到一个有用的答案。 – Rook
先生只有我想搜索datatable作为输入提供的用户可能是任何国家的名称或价格或地点.......................... ..... –