我对这个想法有疑问。我需要的是能够在obj中添加值,即:(obj.issueValue)。返回的列是一堆价格,我需要知道如何将它们全部添加到一起。只是为了让您知道,我在VB.NET中使用iTextSharp进行此操作。这是代码,因为没有代码可以帮助理解
SELECT
QEE.[eventid],
QEE.[eventdate],
QEE.[employee],
QEE.[communication],
QEE.[othercommunication],
QEE.[issue],
QEE.[issuedescription],
QEE.[issuecomments],
QEE.[resolution],
QEE.[resolutioncomments],
QEE.[salesordernumber],
QEE.[customerpo],
QEE.[sostatus],
QEE.[customer],
QEE.[customername],
QEE.[salespersonname],
QEE.[isresolved],
QEE.[issuevalue],
QEE.[dateandtimeadded],
Datediff(day, SOR.reqshipdate, QEE.[eventdate]) AS Elapsed,
SOR.reqshipdate
FROM
[QualityTracking].[dbo].[tblqualityevententry] QEE
INNER JOIN
sysprocompanyc.dbo.sormaster SOR
ON
QEE.salesordernumber = SOR.salesorder COLLATE latin1_general_ci_as
WHERE eventdate BETWEEN @from AND @to
ORDER BY
eventdate ASC,
customername ASC,
salesordernumber ASC;
obj.issueValue = IIf(dr("IssueValue") Is DBNull.Value, 0.0, Val(dr("IssueValue")))
sumTable.AddCell(New iTextSharp.text.Phrase(obj.issue.ToString(), FontFactory.GetFont("Arial", 15, iTextSharp.text.Font.NORMAL)))
sumTable.AddCell(New iTextSharp.text.Phrase(obj.qty, FontFactory.GetFont("Arial", 15, iTextSharp.text.Font.NORMAL)))
sumTable.AddCell(New iTextSharp.text.Phrase(obj.issueDescription.ToString(), FontFactory.GetFont("Arial", 15, iTextSharp.text.Font.NORMAL)))
sumTable.AddCell(New iTextSharp.text.Phrase(obj.grandTotal, FontFactory.GetFont("Arial", 20, iTextSharp.text.Font.NORMAL)))
obj.grandTotal是目标。我只想要显示整个列的总和,所以我需要的是将它们全部加在一起并吐出总数的函数。
答案 0 :(得分:0)
也许您可以尝试下面的某些类型转换功能......
Debug.WriteLine(CStr(CDec("5") + CDec("5")))
写出10