嗨抱歉英语不好
我在.mdb格式的访问数据库中有3个表 - 我在vs 2010中使用此数据库作为数据源。我有一个带有以下填充查询的TableAdapter(连接是MS Jet 4.0):
SELECT a.ID AS AmelID, a.NamAmel, a.MoshtariRef, a.ShHesab, a.Kod, a.NamF, a.NamSM, derivedtbl_1.MablaghKol, derivedtbl_1.Cnt, iif(derivedtbl_2.MablaghKolBrg is Null, 0,derivedtbl_2.MablaghKolBrg) As MablaghKolBrg, iif(derivedtbl_2.CntKolBrg is Null, 0,derivedtbl_2.CntKolBrg) As CntBrg,
iif(derivedtbl_3.MablaghKolVsl is Null, 0,derivedtbl_3.MablaghKolVsl) As MablaghKolVsl,iif(derivedtbl_3.CntVsl is Null, 0,derivedtbl_3.CntVsl) As CntVsl
FROM ((((SELECT Amel.ID, Amel.NamAmel, Chek.MoshtariRef, Chek.ShHesab, Moshtari.Kod, Moshtari.NamF, Moshtari.NamSM
FROM ((Amel INNER JOIN
Chek ON Amel.ID = Chek.ID) INNER JOIN
Moshtari ON Amel.ID = Moshtari.AmelRef)
GROUP BY Amel.ID, Amel.NamAmel, Chek.MoshtariRef, Chek.ShHesab, Moshtari.Kod, Moshtari.NamF, Moshtari.NamSM) a LEFT OUTER JOIN
(SELECT SUM(Mablagh) AS MablaghKolVsl, COUNT(Mablagh) AS CntVsl, MoshtariRef, ShHesab
FROM Chek Chek_3
WHERE (Status = '1')
GROUP BY MoshtariRef, ShHesab) derivedtbl_3 ON a.MoshtariRef = derivedtbl_3.MoshtariRef AND a.ShHesab = derivedtbl_3.ShHesab) LEFT OUTER JOIN
(SELECT SUM(Mablagh) AS MablaghKol, COUNT(Mablagh) AS Cnt, MoshtariRef, ShHesab
FROM Chek Chek_1
GROUP BY MoshtariRef, ShHesab) derivedtbl_1 ON a.MoshtariRef = derivedtbl_1.MoshtariRef AND a.ShHesab = derivedtbl_1.ShHesab) LEFT OUTER JOIN
(SELECT SUM(Mablagh) AS MablaghKolBrg, COUNT(Mablagh) AS CntKolBrg, MoshtariRef, ShHesab
FROM Chek Chek_2
WHERE (Status = '2')
GROUP BY MoshtariRef, ShHesab) derivedtbl_2 ON a.ShHesab = derivedtbl_2.ShHesab AND a.MoshtariRef = derivedtbl_2.MoshtariRef)
为了避免获得Null值我在最后4列中创建了一个IIF语句,这在访问中工作正常,但在vs表适配器中会出现以下错误:
Error in list of function arguments: 'IS' not recognized.
Unable to parse query text.
在同一时间我看到结果为0而不是空值,这意味着IIF语句正常工作。
但我需要表适配器来填充由于错误而未发生的表。 我该怎么办?
提前致谢
答案 0 :(得分:0)
找到它:D
只需手动创建表格中的列。无论您是在数据网格还是报表中使用它,它都会起作用。只需确保查询中的列名与表中的列名相匹配。