泰哥,水表
泰哥,我用俩个sql语句填充dataset时候,这样
da = new SqlDataAdapter("select count(computer_idn) as ip,company as company from (select a.*,b.company from computer a,(select b.computer_idn,a.Company,b.IpAddress from gongsia a,BoundAdapter b where left(a.IpAddress,12)=left(b.IpAddress,12) union select b.computer_idn,a.Company,b.IpAddress from gongsib a,BoundAdapter b where a.ipaddress=b.ipaddress ) b where a.computer_idn=b.computer_idn) a group by Company order by company", conn);
da.Fill(ds1, "Companya");
da = new SqlDataAdapter("select count(computer_idn)as name,company as company from (select a.Computer_idn,b.ComPany,a.Reason,a.Vulnerability_Idn from CVDetected a,(select a.*,b.company from computer a,(select b.computer_idn,a.Company,b.IpAddress from gongsia a,BoundAdapter b where left(a.IpAddress,12)=left(b.IpAddress,12) union select b.computer_idn,a.Company,b.IpAddress from gongsib a,BoundAdapter b where a.ipaddress=b.ipaddress) b where a.computer_idn=b.computer_idn ) b where a.computer_idn=b.computer_idn and a.Vulnerability_Idn=2671) a group by Company order by Company", conn);
da.Fill(ds1, "computer");
俩个xsd中datatable不是数据库中的字段,是sql语句的as 字段,我把2个sql语句的as字段的company关联,但是出来的不是俩个公司相等的数据,是第一个表*第二个表的数据