gpt4 book ai didi

c# - 如何从 tableAdapter 获取数据

转载 作者:行者123 更新时间:2023-11-30 23:29:24 25 4
gpt4 key购买 nike

我正在使用数据集和网络服务,在我的网络服务方法中,我调用并执行了我在数据库中创建的过程,所以我的问题是我有来自数据库的结果,但我不知道如何使用或调用数据本身。

我该怎么做?

我尝试搜索,但我得到的所有结果都是关于我不想使用的连接字符串的。这是我第一次使用数据集和 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com