泰哥,水表

w87875251l 2010-11-08 10:21:59
泰哥,我用俩个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关联,但是出来的不是俩个公司相等的数据,是第一个表*第二个表的数据
...全文
80 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
阿双2009 2010-11-08
  • 打赏
  • 举报
回复
打开 数据库专家,切换到 链接 标签页,在这边设置下表之间的关联
阿泰 2010-11-08
  • 打赏
  • 举报
回复
dataset中的约束关系,在水晶报表中是不能自动获取的
所以需要手动设置两个表的关系,如 雙 所说,操作方法见下图

4,815

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 图表区
社区管理员
  • 图表区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧