作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用数据集和网络服务,在我的网络服务方法中,我调用并执行了我在数据库中创建的过程,所以我的问题是我有来自数据库的结果,但我不知道如何使用或调用数据本身。
我该怎么做?
我尝试搜索,但我得到的所有结果都是关于我不想使用的连接字符串的。这是我第一次使用数据集和 Web 服务,所以可能我用错误的关键字进行搜索。
这是我的代码,最后一行是我停下来不知道如何继续的地方。
newCityTable 有程序的结果。
OrderDatasetTableAdapters.getCityNameTableAdapter newOrder = new OrderDatasetTableAdapters.getCityNameTableAdapter();
newOrder.GetCityNameData();
OrderDataset.getCityNameDataTable newCityTable;
newCityTable = newOrder.GetCityNameData();
最佳答案
终于找到了答案,在这里分享给大家。也许有人会发现它有帮助。
string city;
// i here refers to the variable in a for loop. you can do whatever you want before like using loop, fetch a specific row or create an array..etc but this is the way to get the data that you want
city = (string) newCityTable.Rows[i].ItemArray[0];
关于c# - 如何从 tableAdapter 获取数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35461951/
我是一名优秀的程序员,十分优秀!