我的疑问:
SqlDataAdapter daaa = new SqlDataAdapter("SELECT DISTINCT inq.InquiryId,inq.Inquiry_Date,inq.Factor_Code,inq.CustomerName,"+
"inq.TermsPayment,inq.DeliveryTime,trd.TrCellType from inquiry AS inq LEFT JOIN inquiryjoin " +
"ON inq.InquiryId = inquiryjoin.InquiryId " +
" LEFT JOIN traditional AS trd " +
"ON trd.TraditionalId = inquiryjoin.TId " +
" LEFT JOIN compact " +
"ON compact.CompactId = inquiryjoin.TId " +
" LEFT JOIN air " +
"ON air.AirId = inquiryjoin.TId where " +
"inq.Inquiry_Date = N'" + stdate + "' " +
" ORDER BY inq.InquiryId", Conn);
(trd.TrCellType)未在报告中显示?
答案 0 :(得分:0)
首先在sqlserver中运行此代码,我认为在表“ LEFT JOIN传统AS trd ”的左连接中没有表中有此条件的数据
首先在sqlserver端得到正确的结果,如果没有问题,那么肯定会有水晶报告显示数据。
SELECT DISTINCT inq.inquiryid,
inq.inquiry_date,
inq.factor_code,
inq.customername,
inq.termspayment,
inq.deliverytime,
trd.trcelltype FROM inquiry AS inq
LEFT JOIN inquiryjoin
ON inq.inquiryid = inquiryjoin.inquiryid
LEFT JOIN traditional AS trd
ON trd.traditionalid = inquiryjoin.tid
LEFT JOIN compact
ON compact.compactid = inquiryjoin.tid
LEFT JOIN air
ON air.airid = inquiryjoin.tid
WHERE inq.inquiry_date = N'2013 / 01/01' ORDER BY inq.inquiryid