如何将 DataGridView 中的多行添加到数据库中的表中?

发布于 2024-10-02 06:11:06 字数 175 浏览 0 评论 0原文

在我的 DataGridView 中,大约有 2 或 3 行关于供应商数据 它与供应商数据有关,因为我可能从 2 或 3 个供应商那里获得一种产品 当我单击按钮(确认添加)时,如何从数据网格视图将供应商ID(FK)添加到数据库中的产品表并避免数据冗余 我认为它可能会将 2 或 3 个供应商 ID 保存为记录,但我不知道该怎么做?

in my DataGridView there are about 2 or 3 rows about the Supplier data
it is about Supplier data ,,as there might be one product i get from 2 or 3 suppliers
how to add the Suppliers_ID (FK) to the Product table in the data base from the data grid view when i click on a button (Confirm adding) and to avoid the data redundancy
i think it might be saving the 2 or 3 Suppliers_ID as Records but i donknow how to do this ?

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

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

发布评论

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

评论(1

忆依然 2024-10-09 06:11:06

您需要在两个表之间创建主从关系。以下链接适用于 DataGrid,但您可以对 DataGridView 使用相同的逻辑:

http://msdn.microsoft.com/en-us/library/59y45529(vs.100).aspx

希望这会有所帮助。

You need to create a master-detail relationship between your two tables. This below link is for DataGrid but you can use the same logic for DataGridView:

http://msdn.microsoft.com/en-us/library/59y45529(vs.100).aspx

Hope this helps.

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