select main.*,sub.WOREntry FROM ( select case 1 when 1 then (select distinct top 1 cCaiLiaoCode from t_BaoJia_ZhuYaoBuJian where cMainCode='201204120065' and cZhiXiangXuNiCode=cZhiZhangCode) end as ItemCode, case 1 when 1 then (select DISTINCT cast(iGuige_Length AS NVARCHAR(100))+'×'+cast(iGuige_Width as NVARCHAR(100)) from t_BaoJia_ZhuYaoBuJian where cMainCode='201204120065' and cZhiXiangXuNiCode=cZhiZhangCode) end as GuiGe, iNum+iNum_Sunhao as QuantityLine,iDunzhong from t_baojia_CailiaoCaigou where cMainCode='201204120065' union ALL select cFuLiaoCode,'',iNum+iSunhao as QuantityLine,0 from t_Baojia_Fuliao where cMainCode='201204120065' ) as main left join (select WOREntry from t_Baojiao_Main where cCode='201204120065') as sub on 1=1 是这样一条语句,其中QuantityLine是取的表t_baojia_CailiaoCaigou中的两个字段相加得到的,这些查询出的值被我放到了一个datetable里,然后从datetable取值得时候就只有QuantityLine这个值取不出来 但是拿到数据库中执行是能查出值得
(
select
case 1
when 1 then
(select distinct top 1 cCaiLiaoCode from t_BaoJia_ZhuYaoBuJian where cMainCode='201204120065' and cZhiXiangXuNiCode=cZhiZhangCode) end as ItemCode,
case 1
when 1 then
(select DISTINCT cast(iGuige_Length AS NVARCHAR(100))+'×'+cast(iGuige_Width as NVARCHAR(100))
from t_BaoJia_ZhuYaoBuJian where cMainCode='201204120065' and cZhiXiangXuNiCode=cZhiZhangCode) end as GuiGe, iNum+iNum_Sunhao as QuantityLine,iDunzhong
from t_baojia_CailiaoCaigou where cMainCode='201204120065' union ALL
select cFuLiaoCode,'',iNum+iSunhao as QuantityLine,0 from t_Baojia_Fuliao where cMainCode='201204120065' )
as main
left join (select WOREntry from t_Baojiao_Main where cCode='201204120065') as sub on 1=1
是这样一条语句,其中QuantityLine是取的表t_baojia_CailiaoCaigou中的两个字段相加得到的,这些查询出的值被我放到了一个datetable里,然后从datetable取值得时候就只有QuantityLine这个值取不出来
但是拿到数据库中执行是能查出值得
owor.Lines.UserFields.Fields.Item("U_zhang").Value = lineTable.Rows(j)("QuantityLine")
这里是赋值,我的目的是owor是我定义的一个接口,用来往另外一个数据库导入数据。结果到了钱两个lines有值,程序跑到第三个lines就异常了