标题:求助,写的程序帮忙看下
只看楼主
mj77172469
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2012-11-22
结帖率:0
已结贴  问题点数:20 回复次数:4 
求助,写的程序帮忙看下
string sql4 = string.Empty;
                    sql4 = @"select device.id from device, event1 where device.IDENTIFY=event1.MC_HOST_ADDRESS and device.TYPE=event1.MC_ORIGIN_CLASS and device.OBJECT =event1.MC_OBJECT_OWNER  and device.TYPE='服务器'
                            union all
                            select device.id from device, event1 where device.IDENTIFY=event1.MC_HOST_ADDRESS and device.TYPE=event1.MC_ORIGIN_CLASS and device.OBJECT =event1.MC_OBJECT_OWNER and device.SUBOBJECT=event1.MC_OBJECT and device.TYPE='数据库'
                            union all
                            select device.id from device, event1 where device.IDENTIFY=event1.MC_HOST_ADDRESS and device.TYPE=event1.MC_ORIGIN_CLASS and device.OBJECT =event1.MC_OBJECT_OWNER and device.SUBOBJECT=event1.MC_OBJECT and device.TYPE='中间件' ";
                           
                        oc.ExecuteReader(sql4);
                   //     int "+id+" = oc.ExecuteReader(sql4);

                        if( "+id+" != null)


                        {   string sql5 = string.Empty;
                     sql5=@"insert into alert (alert.id,alert.eventid,alert.deviceid,alert.status,alert.parameter,alert.value,alert.severity,alert.msg,alert.ticketid,alert.ticketstatus,alert.timestamp,alert.createtime,alert.lastmodifiedtime) values ('9999',event1.mc_tool_sev,
 '+id+',event1.status,event1.MC_PARAMETER,event1.mc_parameter_value,'2',event1.msg,event1.mc_object_uri,event1.mc_service,event1.MC_INCIDENT_TIME,event1.MC_ARRIVAL_TIME,event1.DATE_RECEPTION)";
                     oc.ExecuteReader(sql5);
                        
                        }

                        
                        else;


                        {
                         return;
      
                        }
搜索更多相关主题的帖子: 服务器 where 
2012-11-22 13:30
mj77172469
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2012-11-22
得分:0 
我在sql里查出来的id  可以直接if( "+id+" != null) 使用吗
2012-11-22 13:30
newdos
Rank: 9Rank: 9Rank: 9
等 级:禁止访问
威 望:6
帖 子:251
专家分:1169
注 册:2012-8-13
得分:10 
C#,你发错版了,这里是C++版。
if( "+id+" != null) 你这是什么意思?一个常量字符串和null值进行不等比较?表达式结果永远为真。
2012-11-22 13:49
mj77172469
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2012-11-22
得分:0 
回复 3楼 newdos
你帮我看下被 谢谢了
那我改成
  oc.ExecuteReader(sql4);
                    int id = oc.ExecuteReader(sql4);

                        if( id!= null)
{。。。

可以吗
2012-11-22 14:02
mmmmmmmmmmmm
Rank: 10Rank: 10Rank: 10
等 级:青峰侠
威 望:8
帖 子:388
专家分:1809
注 册:2012-11-2
得分:10 
不会 顺便学习一下

我们的目标只有一个:消灭0回复!
while(1)
++money;
2012-11-22 14:15



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-387930-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.270415 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved