使用 vb.net 中的表适配器迭代表的行

发布于 2024-09-25 14:46:43 字数 411 浏览 1 评论 0原文

我有一个问题。我有一个带有 tableadpater 的数据库。我想用这个表适配器获取用户ID。

 Dim dsGN As New ForumTableAdapters.Message2TableAdapter

    Dim dtBetrieb As Data.DataTable = dsGN.GetUserIdFromThisMessage(ConversationID)

    For Each objRow As dsGN.Message2Row In dtBetrieb.Rows

        mystring = objRow.UserId.ToString
    Next

我收到错误“dsGN.Message2Row 未定义”

我在数据库中的表的名称是“Message” 我希望有人能帮助我。

i have a problem. I have database with a tableadpater. i want to get the userid with this tableadapter.

 Dim dsGN As New ForumTableAdapters.Message2TableAdapter

    Dim dtBetrieb As Data.DataTable = dsGN.GetUserIdFromThisMessage(ConversationID)

    For Each objRow As dsGN.Message2Row In dtBetrieb.Rows

        mystring = objRow.UserId.ToString
    Next

i get the error "dsGN.Message2Row is not defined"

The Name ob my table in the database is "Message"
i hope that somebody can help me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

温折酒 2024-10-02 14:46:43

你必须这样做:

GridView.DataSource = yourAdapter.GetUserID(ID);
GridView.DataBind();

然后创建一个名为:GetUserID 的表适配器,您可以从表中选择传递 ID,如:@ID;

希望这有帮助!
您可以在此处阅读有关此内容的更多信息:

http://msdn.microsoft.com/en -us/library/aa581776.aspx

You have to do this :

GridView.DataSource = yourAdapter.GetUserID(ID);
GridView.DataBind();

Then make a tableadapter named:GetUserID where you select from your tables passing the ID like: @ID;

Hope this helped!
You can read more about this here:

http://msdn.microsoft.com/en-us/library/aa581776.aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文