嗨,我正在尝试加入 2 个数据表,左边的一个包含 3 个不同的列作为主键,另一个包含与外键相同的列,这是左边的数据表图像:
正确的 DataTable Imge 是这个:
这是我正在尝试使用的代码,但没有返回任何内容,它应该
var query5 =
from ChanToNGrsToNgrDAnWal in chanToNGrsToNgrDAnWal.AsEnumerable()
join Node in node.AsEnumerable()
on new {
A = ChanToNGrsToNgrDAnWal.Field<int?>("diffusers_Id"),
B = ChanToNGrsToNgrDAnWal.Field<int?>("analogs_Id"),
C = ChanToNGrsToNgrDAnWal.Field<int?>("wallstats_Id") }
equals new {
A = Node.Field<int?>("diffusers_Id"),
B = Node.Field<int?>("analogs_Id"),
C = Node.Field<int?>("wallstats_Id")
}
select new
{
channel_Id = ChanToNGrsToNgrDAnWal.Field<int?>("channel_Id"),
number = ChanToNGrsToNgrDAnWal.Field<string>("number"),
nodeGroups_Id = ChanToNGrsToNgrDAnWal.Field<int>("nodeGroups_Id"),
analogNodeSerial = ChanToNGrsToNgrDAnWal.Field<string>("analogNodeSerial"),
diffuserNodeSerial = ChanToNGrsToNgrDAnWal.Field<string>("diffuserNodeSerial"),
wallStatNodeSerial = ChanToNGrsToNgrDAnWal.Field<string>("wallStatNodeSerial"),
diffusers_Id = ChanToNGrsToNgrDAnWal.Field<int?>("diffusers_Id"),
analogs_Id = ChanToNGrsToNgrDAnWal.Field<int?>("analogs_Id"),
wallstats_Id = ChanToNGrsToNgrDAnWal.Field<int?>("wallstats_Id"),
typeCode = Node.Field<string>("typeCode"),
node_Id = Node.Field<int?>("node_Id")
};
谁能告诉我为什么会这样或者我写的查询是错误的,请你们帮帮我。