Z
Zac Maclean
I need to loop through a DataReader.
The data it contains is in the following format (presented here as CSV, To
and From fields are dates):
Widget 1, Property 1, To, From
Widget 1, Property 2, To, From
Widget 1, Property 3, To, From
Widget 1, Property 4, To, From
Widget 1, Property 5, To, From
Widget 1, Property 6, To, From
Widget 1, Property 7, To, From
Widget 1, Property 8, To, From
Widget 1, Property 9, To, From
Widget 1, Property 10, To, From
Widget 2, Property 1, To, From
Widget 2, Property 2, To, From
Widget 2, Property 3, To, From
Widget 2, Property 4, To, From
Widget 2, Property 5, To, From
Widget 2, Property 6, To, From
Widget 2, Property 7, To, From
Widget 2, Property 8, To, From
Widget 2, Property 9, To, From
Widget 2, Property 10, To, From
I am building another table to be displayed as follows:
Widget_____|| Prop 1___ || Prop 2__ || Prop 3___ || Prop 4__ ||
-----------------------------------------------------------------------
Widget 1____|| To | From || To | From || To | From || To | From ||
-----------------------------------------------------------------------
Widget 2____|| To | From || To | From || To | From || To | From ||
/end feeble ASCII table rendition
Now.. I've gotten this work in flat ASP using a RecordSet, building a table
like above, but only with the "To" information, in ASP I am only able to
loop properly a single time without repeating the code, and changing almost
every line. I need to read this data 2 times, to get a To and From and
count. I placed the code to parse the data in a class, sending the needed
info over to get this going.. but I am missing something in the switch from
ASP to ASP.NET.
------- code ------
while (dr.Read())
{
strWidgetName = (string)dr.GetSqlString(0);
strWidgetNameOld = strWidgetName;
strWidgets[intCount] = strWidgetName;
// Fill Widget Name array
while (strWidgetName == strWidgetNameOld) // && (dr.Read()))
{
#region "Report logic is here and working. My problem is with the
looping."
boolDebug = dr.Read();
if (dr.Read() == false)
{
break;
}
else
{
clsReport.drCat.Read();
strWidgetNameOld = strWidgetName;
strWidgetName = (string)dr.GetSqlString(1);
}
}
intCount = ++intCount;
}
-------------- end code ------------------------
I've moved the pieces of the last Else statement around, seeing if that
would fix it. What I am seeing now it loops either too many times, or it
gets stuck on one Widget, and never progresses to the next.
If needed, I have working ASP (vbscript) code that has similar goal.
Zac Maclean
The data it contains is in the following format (presented here as CSV, To
and From fields are dates):
Widget 1, Property 1, To, From
Widget 1, Property 2, To, From
Widget 1, Property 3, To, From
Widget 1, Property 4, To, From
Widget 1, Property 5, To, From
Widget 1, Property 6, To, From
Widget 1, Property 7, To, From
Widget 1, Property 8, To, From
Widget 1, Property 9, To, From
Widget 1, Property 10, To, From
Widget 2, Property 1, To, From
Widget 2, Property 2, To, From
Widget 2, Property 3, To, From
Widget 2, Property 4, To, From
Widget 2, Property 5, To, From
Widget 2, Property 6, To, From
Widget 2, Property 7, To, From
Widget 2, Property 8, To, From
Widget 2, Property 9, To, From
Widget 2, Property 10, To, From
I am building another table to be displayed as follows:
Widget_____|| Prop 1___ || Prop 2__ || Prop 3___ || Prop 4__ ||
-----------------------------------------------------------------------
Widget 1____|| To | From || To | From || To | From || To | From ||
-----------------------------------------------------------------------
Widget 2____|| To | From || To | From || To | From || To | From ||
/end feeble ASCII table rendition
Now.. I've gotten this work in flat ASP using a RecordSet, building a table
like above, but only with the "To" information, in ASP I am only able to
loop properly a single time without repeating the code, and changing almost
every line. I need to read this data 2 times, to get a To and From and
count. I placed the code to parse the data in a class, sending the needed
info over to get this going.. but I am missing something in the switch from
ASP to ASP.NET.
------- code ------
while (dr.Read())
{
strWidgetName = (string)dr.GetSqlString(0);
strWidgetNameOld = strWidgetName;
strWidgets[intCount] = strWidgetName;
// Fill Widget Name array
while (strWidgetName == strWidgetNameOld) // && (dr.Read()))
{
#region "Report logic is here and working. My problem is with the
looping."
boolDebug = dr.Read();
if (dr.Read() == false)
{
break;
}
else
{
clsReport.drCat.Read();
strWidgetNameOld = strWidgetName;
strWidgetName = (string)dr.GetSqlString(1);
}
}
intCount = ++intCount;
}
-------------- end code ------------------------
I've moved the pieces of the last Else statement around, seeing if that
would fix it. What I am seeing now it loops either too many times, or it
gets stuck on one Widget, and never progresses to the next.
If needed, I have working ASP (vbscript) code that has similar goal.
Zac Maclean