我有連接4臺爲什麼這個事業在C#中ArithmeticException時的sqlplus一切ok
CREATE VIEW BookCopyInfo
AS
SELECT
bc.BookCopyID, b.BookTitle, m.FirstName || ' ' || m.LastName AS BorrowedBy,
l.expectedReturnDate, (SYSDATE - l.expectedReturnDate) AS NoOfDaysLate
FROM Book b, Member m, Lending l, BookCopy bc
WHERE b.BookID = bc.BookID AND l.MemberID = m.MemberID
AND l.BookCopyID = bc.BookCopyID
有一個小的日期計算要對發現有多少天是一本書晚視圖
(SYSDATE - l.expectedReturnDate)
當我做了SELECT * FROM BookCopyInfo
,我得到這樣
4 | Human Computer Interaction | Alan Paul | 10-JUL-10 | -13.642292
行,以便它是正確的, -13實際上是正確的答案。
DESC BookCopyInfo
返回
Name Null? Type
----------------------------------------- -------- ---------------
BOOKCOPYID NOT NULL NUMBER(38)
BOOKTITLE NOT NULL VARCHAR2(100)
BORROWEDBY VARCHAR2(126)
EXPECTEDRETURNDATE NOT NULL DATE
NOOFDAYSLATE NUMBER(38)
然而在C#
DataTable dtBookInfo = new DataTable();
da = new OracleDataAdapter("SELECT * FROM BookCopyInfo", con);
da.Fill(dtBookInfo);
捕獲在da.Fill線
OverflowException異常是由用戶代碼未處理的異常。
算術運算導致溢出。
爲什麼它在SQLPlus中正常工作,但在C#中失敗? :S
如果你用一個常量替代'(SYSDATE-l.expectedReturnDate)',那麼它是否工作(在你的視圖中說'0 AS NoOfDaysLate'?只是爲了確保日期計算實際上導致你的問題... – 2010-06-26 09:12:04
是的。該應用程序運行正常,0 AS NoOfDaysLate:S – 2010-06-26 09:31:46