[Vb.net]将多表绑定到datagridview [英] [Vb.net] bind multi table to datagridview

查看:205
本文介绍了[Vb.net]将多表绑定到datagridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在一个项目上工作.我的项目是管理小型企业的库存.我目前有一个使用SQL Server 2014的数据库.我的数据库包含几个表,其中包括5个表:库存",产品",位置",部门,提供者".

我目前正在使用离线方法ado.net. (我不能使用linq :()

所以,是的,我需要选择上面列出的5个表的特定字段并绑定到datagridview.

例如,我想从产品中获取代码,说明,税金,价格.数量,公司来自库存.位置描述.部门的部门代码. provider的providerCode并将所有字段绑定到1个datagridview中.

我目前正在使用包含我的整个数据库的强类型数据集".


如果您需要更多信息,只需询问即可!

谢谢大家!

ps:数据库现在是新的,所以要好! ;)

pps:对不起,我的英语,这不是我的母语!

我尝试过的事情:

在问一个问题之前,我做了几项研究,有人说要把所有信息都保存在一个数据表中.这是好方法吗?他是一个更好的方法吗?

I currently work on a project. My project is to manage the inventory of a small business. I currently have a database with SQL server 2014. My database contains several tables including 5 table that is : "Inventory", "Product", "Location", Department", "Provider".

I am currently using the offline method ado.net. (I can''t use linq :( )

So yeah, I need to select certain field of 5 tables listed above and bind to a datagridview.

For example, i want to take code,description,tax,price from product. Quantity, company from inventory. Description from location. DepartmentCode from department. providerCode from provider and bind all that field into 1 datagridview.

Im currently using a "strongly typed dataset" that contain my entire database.


If you need more information, just ask it !

Thanks guys!

ps: currently new with the database so be nice! ;)

pps: Sorry for my english, this is not my first language!

What I have tried:

I did several research before ask a question here, some people say to take all the information and deposit in a datatable. Is it the good way? Is he a better method to do? Maybe i can use stored procedure?

推荐答案

您需要在表上创建联接以返回单个数据集.
请参阅
You need to create a join on the tables to return a single dataset.

See Joins.[^]

There are many tutorial on the internet on how to do these. just search TSQL Joins

Also you could create a database view that has all your joins you need and then select the views.


这篇关于[Vb.net]将多表绑定到datagridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆