程序里的CString里面保存了很长的一段SQL语句,通过watch看只能看一小部分,我想把这段sql语句输出到debug窗口仔细看看,还能复制到plsql里排版看,但是好像不能直接通过TRACE把CString的内容输出到窗口,是不是要把CSring转成string才能输出啊??
解决方案 »
- 代码编译通过,运行不正常,哪里问题
- 导入了一个COM组件,其中的一个对象不知道该如何使用
- Xtreme Toolkit Pro 开发包 reportcontrol 的拖拽问题
- 如何获得Edit控件中的内容阿,郁闷中.....
- 置顶的关于“对付双进程保护”的文章为什么是空的?难道有点技术的文章就被删了吗?
- 哪里有下opengl.dll?在线
- 头文件错误??
- 有人用过SetSuspendState这个API吗?我没找到include它的头文件
- 怎样将LPTSTR类型的指针指向的值取出?
- 急、急、急。怎样读去Excel文件。
- 关于vs2005应用程序无法启动,因为应用程序的并行配置不正确
- 关于CtrlTree设置单独Item颜色的问题
TRACE(_T("%s"),str);
if(CSqlLink::GetDBType()==_sybase)
strSql.Format(_T("select A.OutNo,A.countdb,B.TarrifTypeID,B.OutNoSumKWH,B.OutNoSumKVARH,B.countsum from \
(select OutNo,count(SubObjID) as countdb from POB_CalcItemDts where ItemID=%d and SubObjType=15 and BeginTime<='%s' and (EndTime is null or EndTime>='%s') group by OutNo ) A \
left join ( select b.TarrifTypeID,a.OutNo,\
sum(case (a.SubObjNo) when 1 then (case (a.Symbol ) when 1 then a.Factor * b.KWHRec when 2 then -1*a.Factor * b.KWHRec else 0 end ) when 2 then (case (a.Symbol ) when 1 then a.Factor * b.KWHDel when 2 then -1*a.Factor * b.KWHDel else 0 end ) else 0 end ) as OutNoSumKWH,\
sum(case (a.SubObjNo) when 1 then (case (a.Symbol ) when 1 then a.Factor * b.KVARHRec when 2 then -1*a.Factor * b.KVARHRec else 0 end ) when 2 then (case (a.Symbol ) when 1 then a.Factor * b.KVARHDel when 2 then -1*a.Factor * b.KVARHDel else 0 end ) else 0 end ) as OutNoSumKVARH,count(b.PointID) as countsum from POB_CalcItemDts a,\
(select PointID,TarrifTypeID, KWHRec,KWHDel,KVARHRec,KVARHDel from %s where StartTime='%s' and SchemeID=%d and TarrifTypeID=0) b where a.SubObjID=b.PointID and a.SubObjType=15 and a.ItemID=%d and a.BeginTime<='%s' and (a.EndTime is null or a.EndTime>='%s' ) group by b.TarrifTypeID,a.OutNo ) B on A.OutNo=B.OutNo")
,dwItemID,tEnd.Format("%Y-%m-%d %H:%M:%S"),tBegin.Format("%Y-%m-%d %H:%M:%S"),strTableName,
DataTime.Format("%Y-%m-%d %H:%M:%S"),wSchemeID,dwItemID,tEnd.Format("%Y-%m-%d %H:%M:%S"),tBegin.Format("%Y-%m-%d %H:%M:%S")); else
strSql.Format(_T("select A.OutNo,A.countdb,B.TarrifTypeID,B.OutNoSumKWH,B.OutNoSumKVARH,B.countsum from \
(select OutNo,count(SubObjID) as countdb from POB_CalcItemDts where ItemID=%d and SubObjType=15 and BeginTime<='%s' and (EndTime is null or EndTime>='%s') group by OutNo ) A \
left join ( select b.TarrifTypeID,a.OutNo,\
sum(case (a.SubObjNo) when 1 then (case (a.Symbol ) when 1 then a.Factor * nvl(b.KWHRec,0) when 2 then -1*a.Factor * nvl(b.KWHRec,0) else 0 end ) when 2 then (case (a.Symbol ) when 1 then a.Factor * nvl(b.KWHDel,0) when 2 then -1*a.Factor * nvl(b.KWHDel,0) else 0 end ) else 0 end ) as OutNoSumKWH,\
sum(case (a.SubObjNo) when 1 then (case (a.Symbol ) when 1 then a.Factor * b.KVARHRec when 2 then -1*a.Factor * nvl(b.KVARHRec,0) else 0 end ) when 2 then (case (a.Symbol ) when 1 then a.Factor * nvl(b.KVARHRec,0) when 2 then -1*a.Factor * nvl(b.KVARHDel,0) else 0 end ) else 0 end ) as OutNoSumKVARH,\
count(b.PointID) as countsum from POB_CalcItemDts a,(select PointID,TarrifTypeID, KWHRec,KWHDel,KVARHRec,KVARHDel from %s where StartTime='%s' and SchemeID=%d and TarrifTypeID=0) b where a.SubObjID=b.PointID and a.SubObjType=15 and a.ItemID=%d and a.BeginTime<='%s' and (a.EndTime is null or a.EndTime>='%s' ) group by b.TarrifTypeID,a.OutNo ) B on A.OutNo=B.OutNo")
,dwItemID,tEnd.Format("%Y-%m-%d %H:%M:%S"),tBegin.Format("%Y-%m-%d %H:%M:%S"),strTableName,
DataTime.Format("%Y-%m-%d %H:%M:%S"),wSchemeID,dwItemID,tEnd.Format("%Y-%m-%d %H:%M:%S"),tBegin.Format("%Y-%m-%d %H:%M:%S")); // static CLogFile file("sql.log");
// file.WriteLog(strSql);// AfxMessageBox(strSql);
TRACE(_T("%s"),strsql);
#if defined(_DEBUG)|| !defined(NDEBUG)
#define TRACELONGSTR(strSql) TraceLongStr(strSql)void TraceLongStr(const CString strSql)
{
CString str;
int len =strSql.getlength();
for(i=0;i<len;i+=256)
{
str=strSql.Mid(i,min(i+256,len));
TRACE("%s",str);
}
}
#else
#define TRACELONGSTR(strSql)
#endif//这样使用
RACELONGSTR(StrSql);
afxDump<<XXXX;
#endif