RT,VS2008里面richedit对应的value:m_szProductDesc1有很多行,但是richedit只显示第一行,在循环里打m_szProduct+=m_szOut+"\n",调试的时候看见m_szProductDesc1有很多数据,但显示出来就只有一行。
而且后来我把m_szProductDesc1放进循环,它显示了两次循环的结果,结果也是在同一行,没分行
void CtracewhereDlg::GetAllRouteDesc()
{
CString szDBFile,szADOConnStr;
char szCurDir[256]="c:\\";
GetCurrentDirectory(255,szCurDir);
if(szCurDir[strlen(szCurDir)-1] != '\\')
strcat(szCurDir,"\\");
szDBFile = szCurDir;
szDBFile += "ip.mdb";
szADOConnStr.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s",szDBFile);
CADODatabase db;
if(!db.Open(szADOConnStr))
// return FALSE;
AfxMessageBox("ERROR!");
CString szOut;
for(int i=0;i<glo_arrRoute.GetUpperBound()+1;i++)
{
CString szSQL,szCountry,szLocal;
CADORecordset rs(&db);
szSQL.Format("select * from wry where startip<='%s' and endip >='%s' order by startip desc",glo_arrRoute[i],glo_arrRoute[i]);
glo_arrIPSite.Add("N/A");
if(!rs.Open(szSQL,CADORecordset::openQuery))
continue;
if(rs.IsEOF())
continue;
rs.GetFieldValue("country",szCountry);
rs.GetFieldValue("local",szLocal);
rs.Close();
glo_arrIPSite.ElementAt(i)=szCountry +" " + szLocal;
szOut += glo_arrRoute[i];
szOut += glo_arrIPSite[i];
szOut += "\n";
UpdateData(false);
//TRACE("%s %s\n",glo_arrRoute[i],glo_arrIPSite[i]);
m_szProductDesc1+=szOut+"\n";
}
m_szProductDesc1+=szOut+"\n";
UpdateData(false);
//return TRUE;
}
而且后来我把m_szProductDesc1放进循环,它显示了两次循环的结果,结果也是在同一行,没分行
void CtracewhereDlg::GetAllRouteDesc()
{
CString szDBFile,szADOConnStr;
char szCurDir[256]="c:\\";
GetCurrentDirectory(255,szCurDir);
if(szCurDir[strlen(szCurDir)-1] != '\\')
strcat(szCurDir,"\\");
szDBFile = szCurDir;
szDBFile += "ip.mdb";
szADOConnStr.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s",szDBFile);
CADODatabase db;
if(!db.Open(szADOConnStr))
// return FALSE;
AfxMessageBox("ERROR!");
CString szOut;
for(int i=0;i<glo_arrRoute.GetUpperBound()+1;i++)
{
CString szSQL,szCountry,szLocal;
CADORecordset rs(&db);
szSQL.Format("select * from wry where startip<='%s' and endip >='%s' order by startip desc",glo_arrRoute[i],glo_arrRoute[i]);
glo_arrIPSite.Add("N/A");
if(!rs.Open(szSQL,CADORecordset::openQuery))
continue;
if(rs.IsEOF())
continue;
rs.GetFieldValue("country",szCountry);
rs.GetFieldValue("local",szLocal);
rs.Close();
glo_arrIPSite.ElementAt(i)=szCountry +" " + szLocal;
szOut += glo_arrRoute[i];
szOut += glo_arrIPSite[i];
szOut += "\n";
UpdateData(false);
//TRACE("%s %s\n",glo_arrRoute[i],glo_arrIPSite[i]);
m_szProductDesc1+=szOut+"\n";
}
m_szProductDesc1+=szOut+"\n";
UpdateData(false);
//return TRUE;
}