刚参加工作的应届菜鸟求助

w87875251l 2010-11-10 10:04:32
http://blog.csdn.net/w87875251l/archive/2010/11/02/5983301.aspx
如图,我要实现第二张表,我把表中的列名抽象出一个类,
public class Data
{
public Data()
{
//
// TODO: 在此处添加构造函数逻辑
//
}

private string a;//公司
private int b;//安装代理总数
private int c;//共享目录中威胁数量
private int d;//若密码威胁数量
..........


public string A
{
get { return a; }
set { a = value; }
}
public int B
{
get { return b; }
set { b = value; }
}

public int C
{
}
其他的就省略了
public static Data conv(SqlDataReader dr)
{
Data t = new Data();
t.A = dr["Company"].ToString();
//t.B = dr["newsMsg"].ToString();
t.B = Convert.ToInt32 (dr["geshu"]);

return t;
}

.aspx.cs中写的是
protected void Page_Load(object sender, EventArgs e)
{
Repeater1.DataSource = test() ;
Repeater1.DataBind();
}
public ArrayList test()
{
//ArrayList list = new ArrayList();
SqlConnection conn = db.CreateConnection();
conn.Open();
string sql = "select count(computer_idn)as geshu,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";
SqlCommand cmd = new SqlCommand(sql, conn);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
list.Add(Data.conv(dr));
}
conn.Close();

return list;
}
属性值A,B,C。。。。即对应的列值,但是还要从数据库中的不同表查询字段,Arraylist还要添加列值,然后绑定repeater,我该怎么办??
...全文
210 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
w87875251l 2010-11-10
  • 打赏
  • 举报
回复
帮自己顶。。。
w87875251l 2010-11-10
  • 打赏
  • 举报
回复
我的 qq 591811930
w87875251l 2010-11-10
  • 打赏
  • 举报
回复
慕名而来, 对方拒绝被添加啊,大哥
liffe 2010-11-10
  • 打赏
  • 举报
回复
178666881
w87875251l 2010-11-10
  • 打赏
  • 举报
回复
大哥,你qq多少,能加你吗?谢谢,好不容易找到一份工作
liffe 2010-11-10
  • 打赏
  • 举报
回复
要你表结构,不要你的这写查询语句。想看一下你的表是如何设计的
w87875251l 2010-11-10
  • 打赏
  • 举报
回复
-----共享目录检查中存在威胁数量select count(computer_idn)as geshu,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

----------安装代理总数
select count(computer_idn) as zongshu,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 and b.company in(select distinct d.company from computer c,
(select d.computer_idn,c.Company,d.IpAddress from gongsia c,BoundAdapter d where left(c.IpAddress,12)=left(d.IpAddress,12)
union
select d.computer_idn,c.Company,d.IpAddress from gongsib c,BoundAdapter d where

c.ipaddress=d.ipaddress
) d where c.computer_idn=d.computer_idn)
) a group by Company order by company

--若密码存在威胁数量
select count(computer_idn)as geshu,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=2683
) a group by Company order by Company
等等。。就是每个字段对应一条sql语句
Tanhualin 2010-11-10
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 liffe 的回复:]
你这个问题昨天我想了一下。说一下我的思路(不知道表的结构如何)

1、设计一个对应表格的实体类
2、取得已安装代理总说,然后用一个业务函数做百分比的计算,结果存到对应的实体类中。
3、直接绑定一个Repeater就可以了。
[/Quote]
liffe 2010-11-10
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 w87875251l 的回复:]

你这个回答我已经知道,但是还要从数据库中的不同表查询字段,就是共享目录的威胁数量,弱密码的威胁熟悉,就是还要写sql语句,还要查询,Arraylist还要添加列值,怎么办?
[/Quote]

你的表结构是怎样的?
w87875251l 2010-11-10
  • 打赏
  • 举报
回复
就是一个类对应多个表,多个表的查询语句
w87875251l 2010-11-10
  • 打赏
  • 举报
回复
写多个类,然后arraylist添加,可以吗??
w87875251l 2010-11-10
  • 打赏
  • 举报
回复
你这个回答我已经知道,但是还要从数据库中的不同表查询字段,就是共享目录的威胁数量,弱密码的威胁熟悉,就是还要写sql语句,还要查询,Arraylist还要添加列值,怎么办?
liffe 2010-11-10
  • 打赏
  • 举报
回复
你这个问题昨天我想了一下。说一下我的思路(不知道表的结构如何)

1、设计一个对应表格的实体类
2、取得已安装代理总说,然后用一个业务函数做百分比的计算,结果存到对应的实体类中。
3、直接绑定一个Repeater就可以了。
随着通信电子技术的迅速发展,信息技术给家居行业产生了深远的影响,家居环境的智能化监控已经成为智能家居的一个重要的发展方向。人们逐渐对自己的生活提出一种更高的要求,他们需要一种智能化、可交互,并且融合现代创新科技的产品来改善他们的生活环境,使他们生活更加安全、舒适、便捷、智能。本文根据智能家居的发展背景和研究现状,并且从实用性和可行性角度出发,研究设计了一种基于STM32单片机的智能家居系统。该系统由一个多功能综合的技术系统组成,各个多功能子系统间具有协同配合能力。基于STM32单片机实现的功能子系统包括:智能温度检测,智能湿度检测,智能烟雾/火灾检测智能检测,无线传输,人机交互机构,风扇调节,报警模块。 整个系统分为前端51单片机采集板和后端STM32单片机接收板。 采集板使用DHT11温湿度传感器、MQ烟雾传感器完成室内家居环境的采集。然后通过nRFL24L01将采集到的数据发送给后端。接收板使用LCD1602完成数据显示、使用蜂鸣器模块报警,使用风扇驱动模块调节室内家居环境。本文完成了智能家居控制系统前端、后端软硬件的设计,使用Altium designer绘制了电路原理图,使用Keil C完成了51单片机和STM32单片机的编程与调试。 最后,对本文设计的基于STM32的智能家居控制系统进行部署调试。试验结果表明,该系统可成功应用在智能家居环境检测调节和火灾安全防护的领域,可提高家居生活智能化水平。

62,271

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

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