问题描述
嗨
我有很多表格我想加入他们填写网格视图:
OperatingAreas:OANo, OAName
分区:subarea_id,name.OAName
变电站:substation_id,name,subarea_id
Equipments_Class:equipment_class_id,name
Equipmen_Name:equipment_name_id,name,equipment_class_id,substation_id
我有gridview显示Area,Subaarea,Substation,EqipClass&的名称。 EquipName
(取决于平均多对1)
分区依赖于OperatingAreas
变电站取决于分区
Equipment_Name取决于变电站& Equipment_Class
我在vb.net中的查询:
Hi
I have many tabels I want to join them to fill a gridview:
OperatingAreas: OANo,OAName
Subarea:subarea_id,name.OAName
Substation:substation_id,name,subarea_id
Equipments_Class:equipment_class_id,name
Equipmen_Name:equipment_name_id,name,equipment_class_id,substation_id
I have gridview display the names of Area,Subaarea,Substation,EqipClass & EquipName
(depends on mean many to 1)
Subarea depends on OperatingAreas
Substation depends on Subarea
Equipment_Name depends on Substation & Equipment_Class
My query in vb.net:
"select a.OAName as Area, s.Name as Subarea, ss.Name as Substation, eqc.Name as Equipment_Class, eqn.Equipment_Name_id, eqn.Name as Equipment_Name from Equipments_Names as eqn, " _
& " OperatingAreas as a INNER JOIN Subarea as s on a.OANo = s.OANo INNER JOIN Substations as ss on ss.Subarea_id = s.Subarea_id " _
& " INNER JOIN Equipments_Class as eqc on eqc.Equipment_Class_id = eqn.Equipment_Class_id"
查询不起作用,因为表名Equipments_Names表我不知道如何以正确的方式实现查询
我的frind告诉use使用2个查询一个用于Equipments_Class with Equipments_Name,第二个用于Substations with Equipments_Names在griddiw中的rowdatabound(作为2个数据表)
但是我希望在1个查询中或者在其他单词中使用一个数据表,例如在一个查询中加入2个查询。
任何帮助?
谢谢
the query not works because table name Equipments_Names table I don`t knowhow to implement the query at correct way
My frind told use use 2 queries one for Equipments_Class with Equipments_Name and the second one for Substations with Equipments_Names in a rowdatabound in gridveiw (as 2 datatables)
but I want make them in 1 query or in other word one datatable like join 2 queries in one query.
Any help?
Thank you
推荐答案
这篇关于加入多表vb.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!