2)and i want that the string to be in a loop because no.of queries have to be executed and to store the data in that string?
3) while executing the each loop data should be updated in another string ?
4) finally the data stored in a string should be thrown out???
Here, iam just showing part of the my question... there are queries in code i want the data to be stored in a string???????
void CGanttChartView::InsertBatch(CString csMinSimStartDate ,CString sSecBatchID)
{
COleDateTime minStartDateTime;
minStartDateTime = theApp.m_pGeneric->ConvertDateTime(DATE_TIME_USER_UPDATE,csMinSimStartDate);
if(AddAfter==TRUE)
{
if(csMinSimStartDate ==_T("") || (m_dtSimStopDate<= minStartDateTime))
{
if (!theApp.m_pGeneric->ExecuteSQL(GetSQLStatement(INSERT_SEC_BATCH_SELECT_FROM,ACTIVE,sSecBatchID)))
{
theApp.m_pGeneric->ICOMMessage("Batch Book - 1015",MB_OK,"Secondary Batch record","\n");
theApp.data.Rollback();
}
}
else if(minStartDateTime!=m_dtSimStartDate)
{
CString csDiff=GetMovementwidth(minStartDateTime);
if(!theApp.m_pGeneric->ExecuteSQL(GetSQLStatement(UPDATE_SEC_BATCH_SIM_DATE,ACTIVE,csDiff)))
{
theApp.m_pGeneric->ICOMMessage("Batch Book - 1015",MB_OK,"Secondary Batch record","\n");
theApp.data.Rollback();
}
if (!theApp.m_pGeneric->ExecuteSQL(GetSQLStatement(INSERT_SEC_BATCH_SELECT_FROM,ACTIVE,sSecBatchID)))
{
theApp.m_pGeneric->ICOMMessage("Batch Book - 1015",MB_OK,"Secondary Batch record","\n");
theApp.data.Rollback();
}
}
else if(minStartDateTime==m_dtSimStartDate)
{
CString csDiff=GetMovementwidth(minStartDateTime);
if(!theApp.m_pGeneric->ExecuteSQL(GetSQLStatement(UPDATE_SEC_BATCH_SIM_DATE,ACTIVE,csDiff)))
{
theApp.m_pGeneric->ICOMMessage("Batch Book - 1015",MB_OK,"Secondary Batch record","\n");
theApp.data.Rollback();
}
csDiff=GetMovementwidth(m_dtSimStartDate);
if (!theApp.m_pGeneric->ExecuteSQL(GetSQLStatement(UPDATE_CURRENT_SEC_BATCH,ACTIVE,csDiff)))
{
theApp.m_pGeneric->ICOMMessage("Batch Book - 1015",MB_OK,"Secondary Batch record","\n");
theApp.data.Rollback();
}
if (!theApp.m_pGeneric->ExecuteSQL(GetSQLStatement(INSERT_SEC_BATCH_SELECT_FROM,ACTIVE,sSecBatchID)))
{
theApp.m_pGeneric->ICOMMessage("Batch Book - 1015",MB_OK,"Secondary Batch record","\n");
theApp.data.Rollback();
}
}
}
else if(AddBefore==TRUE)
{
long lVolume = atol(m_sVolume);
double dRate = atol(m_sSimRate);
COleDateTime StartDateTime = theApp.m_pGeneric->ConvertDateTime(DATE_TIME_USER_UPDATE,sbatchNode.sEndDate);
COleDateTime StopDateTime;
StopDateTime.m_dt = StartDateTime.m_dt + (lVolume/dRate)/24;
if(m_dtSimStopDate==minStartDateTime)
{
CString csDiff=GetMovementwidth(m_dtSimStartDate);
if(!theApp.m_pGeneric->ExecuteSQL(GetSQLStatement(UPDATE_SEC_BATCH_SIM_DATE,ACTIVE,csDiff)))
{
theApp.m_pGeneric->ICOMMessage("Batch Book - 1015",MB_OK,"Secondary Batch record","\n");
theApp.data.Rollback();
}
if (!theApp.m_pGeneric->ExecuteSQL(GetSQLStatement(UPDATE_CURRENT_SEC_BATCH,ACTIVE,csDiff)))
{
theApp.m_pGeneric->ICOMMessage("Batch Book - 1015",MB_OK,"Secondary Batch record","\n");
theApp.data.Rollback();
}
if (!theApp.m_pGeneric->ExecuteSQL(GetSQLStatement(INSERT_SEC_BATCH_SELECT_FROM,ACTIVE,sSecBatchID)))
{
theApp.m_pGeneric->ICOMMessage("Batch Book - 1015",MB_OK,"Secondary Batch record","\n");
theApp.data.Rollback();
}
}
else if(minStartDateTime>m_dtSimStopDate && minStartDateTime<stopdatetime)>
{
CString csDiff1,csDiff2;
csDiff1=GetMovementwidth(StopDateTime);
csDiff2=GetMovementwidth(minStartDateTime);
CString csDiff;
csDiff.Format("%ld",atol(csDiff1)-atol(csDiff2));
if(!theApp.m_pGeneric->ExecuteSQL(GetSQLStatement(UPDATE_SEC_BATCH_SIM_DATE,ACTIVE,csDiff)))
{
theApp.m_pGeneric->ICOMMessage("Batch Book - 1015",MB_OK,"Secondary Batch record","\n");
theApp.data.Rollback();
}
csDiff=GetMovementwidth(m_dtSimStartDate);
if (!theApp.m_pGeneric->ExecuteSQL(GetSQLStatement(UPDATE_CURRENT_SEC_BATCH,ACTIVE,csDiff)))
{
theApp.m_pGeneric->ICOMMessage("Batch Book - 1015",MB_OK,"Secondary Batch record","\n");
theApp.data.Rollback();
}
if (!theApp.m_pGeneric->ExecuteSQL(GetSQLStatement(INSERT_SEC_BATCH_SELECT_FROM,ACTIVE,sSecBatchID)))
{
theApp.m_pGeneric->ICOMMessage("Batch Book - 1015",MB_OK,"Secondary Batch record","\n");
theApp.data.Rollback();
}
}
else
{
CString csDiff=GetMovementwidth(m_dtSimStartDate);
if (!theApp.m_pGeneric->ExecuteSQL(GetSQLStatement(UPDATE_CURRENT_SEC_BATCH,ACTIVE,csDiff)))
{
theApp.m_pGeneric->ICOMMessage("Batch Book - 1015",MB_OK,"Secondary Batch record","\n");
theApp.data.Rollback();
}
if (!theApp.m_pGeneric->ExecuteSQL(GetSQLStatement(INSERT_SEC_BATCH_SELECT_FROM,ACTIVE,sSecBatchID)))
{
theApp.m_pGeneric->ICOMMessage("Batch Book - 1015",MB_OK,"Secondary Batch record","\n");
theApp.data.Rollback();
}
}
}
CRecordset recordSet(&theApp.data);
long lColNum=0;
CString sSecID;
if(bRepeat!=FALSE)
{
if (theApp.m_pGeneric->OpenRecordSet(&recordSet,GetSQLStatement(SEC_BATCH_ID,ACTIVE,m_sID)))
{
while (recordSet.IsEOF() != TRUE)
{
recordSet.GetFieldValue((short)lColNum, sSecID);
if(m_sSecBatchID==sSecID)
{
recordSet.GetFieldValue((short)lColNum+2, m_sSimStartDate);
recordSet.GetFieldValue((short)lColNum+3, m_sSimStopDate);
}
recordSet.MoveNext();
}
recordSet.Close();
}
}
if(AddAfter==TRUE)
AddAfter=FALSE;
if(AddBefore==TRUE)
AddBefore=FALSE;
if(Paste==TRUE)
Paste=FALSE;
}