以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  sql报错  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=111297)

--  作者:home8225
--  发布时间:2017/12/19 19:15:00
--  sql报错
提示AS附近有语法错误*3,求助。。。。。。

se lect * from (Sel ect [ITEM_ID] as [主件ID],[ITEM_CODE] as [主件品号],[ITEM_NAME] as [主件品名],[SHORTCUT] as [主件材质],[ITEM_SPECIFICATION] as [主件规格],[DRAWING_NO] as [主件图号],[BOM_ID] From {BOM} Inner JOIN {ITEM} ON {ITEM}.[ITEM_BUSINESS_ID] = {BOM}.[ITEM_ID] AS {A}) inner join (Se lect [SOURCE_ID_ROid],[ITEM_CODE] as [元件品号],[ITEM_NAME]as [元件品名],[SHORTCUT] as [元件材质],[ITEM_SPECIFICATION]as [元件规格],[DRAWING_NO]as [元件图号],[BOM_ID] From {BOM_D} Inner JOIN {ITEM} ON {ITEM}.[ITEM_BUSINESS_ID] = {BOM_D}.[SOURCE_ID_ROid] AS {B}) on {A}.[BOM_ID] ={B}.[BOM_ID] left join (Sel ect round(avg([UNIT_COST]),2) as [采购均价],[ITEM_ID] From {INV_UNIT_COST} Inner JOIN {ITEM} ON {ITEM}.[ITEM_BUSINESS_ID] = {INV_UNIT_COST}.[ITEM_ID] Where datediff(year,[ACCOUNT_YEAR],getdate())=0 Group By [ITEM_ID] AS {C}) on {C}.[ITEM_ID]= {B}.[[SOURCE_ID_ROid]

--  作者:有点蓝
--  发布时间:2017/12/19 20:33:00
--  
 as 后面的别名不需要大括号。另外位置不对

se lect * from (Sel ect [ITEM_ID] As [主件ID],[ITEM_CODE] As [主件品号],[ITEM_NAME] As [主件品名],[SHORTCUT] As [主件材质],[ITEM_SPECIFICATION] As [主件规格],[DRAWING_NO] As [主件图号],[BOM_ID] From {BOM} Inner JOIN {ITEM} ON {ITEM}.[ITEM_BUSINESS_ID] = {BOM}.[ITEM_ID]) as a inner join (Se lect [SOURCE_ID_ROid],[ITEM_CODE] As [元件品号],[ITEM_NAME]As [元件品名],[SHORTCUT] As [元件材质],[ITEM_SPECIFICATION]As [元件规格],[DRAWING_NO]As [元件图号],[BOM_ID] From {BOM_D} Inner JOIN {ITEM} ON {ITEM}.[ITEM_BUSINESS_ID] = {BOM_D}.[SOURCE_ID_ROid]) as b on A.[BOM_ID] =B.[BOM_ID] left join (Sel ect round(avg([UNIT_COST]),2) As [采购均价],[ITEM_ID] From {INV_UNIT_COST} Inner JOIN {ITEM} ON {ITEM}.[ITEM_BUSINESS_ID] = {INV_UNIT_COST}.[ITEM_ID] Where datediff(year,[ACCOUNT_YEAR],getdate())=0 Group By [ITEM_ID]) as c on C.[ITEM_ID]= B.[[SOURCE_ID_ROid]


--  作者:home8225
--  发布时间:2017/12/20 10:30:00
--  
谢谢~!
--  作者:home8225
--  发布时间:2017/12/20 10:44:00
--  
全面报错???提示修改了只读数据.......

图片点击可在新窗口打开查看此主题相关图片如下:qq截图20171220104349.png
图片点击可在新窗口打开查看

--  作者:有点甜
--  发布时间:2017/12/20 10:49:00
--  

试试,去掉提示。

 

Dim dt = DataTables("表A").basetable
For Each r As object In dt.rows
    For Each c As object In dt.columns
        r.SetColumnError(c.tostring, "")
    Next
    r.RowError = ""
Next


--  作者:home8225
--  发布时间:2017/12/20 11:35:00
--  
谢谢,已经解决了,是sql加载列有问题图片点击可在新窗口打开查看