floppy
Posts: 3
|
Posted: 07/30/2004, 4:27 AM |
|
i was wondering if i want to embed loop in a loop, but the codecharge may be does not work.
Any kind of help would be appreciated
|
|
|
Benjamin Krajmalnik
|
Posted: 08/01/2004, 11:32 PM |
|
This is in ASP, but should help.
'Retrieve Serial Numbers
CommaFlag = False
MyCount =
CLng(CCDLookUp("Count(SerialNumber)","SerialNumbers","FKInvoiceDetail =
"&LineItems.Recordset.Fields("InvoiceDetailKeyID"),DBMyDB))
' Read Invoice Number from URL
InvoiceNumber = CCGetFromGet("InvoiceNumber", 0)
If (InvoiceNumber > 0) and (MyCount > 0) then
SQL = "SELECT SerialNumber FROM SerialNumbers WHERE FKInvoiceDetail
="&LineItems.RecordSet.Fields("InvoiceDetailKeyID")
' Open the recordset
Set RecordSet = DBMyDB.Execute(SQL)
If DBMyDB.Errors.Count = 0 Then
If NOT RecordSet.EOF then
if MyCount > 1 then
LineItems.SerialNos.Value = MyCount&" Serial Numbers: "
else
LineItems.SerialNos.Value = "Serial Number :"
end if
WHILE NOT RecordSet.EOF
if CommaFlag = False then
LineItems.SerialNos.Value = Trim(LineItems.SerialNos.Value) &" "&
RecordSet.Fields("SerialNumber")
else
LineItems.SerialNos.Value = Trim(LineItems.SerialNos.Value) &", "&
RecordSet.Fields("SerialNumber")
end if
CommaFlag = True
RecordSet.MoveNext
WEND
End if
' Close the recordset
RecordSet.Close
Set RecordSet = Nothing
Else
End If
else
LineItems.SerialNos.Value = ""
End if
|
|
|
|