>我有以下语句,该语句在"From"子句中存在语法错误,该子句有几个大表名称。实际的数据库名称与表相同,因此它们都是独立的。
我打开一个与 SealRegister mdb 的连接,它是空的(还没有表(,然后在语句上打开 ExecuteNonQuery。我认为这应该在 SealRegister.mdb 中创建表格 SealRegister。
sqlcommand = @"Select ""Plant"" As Geometry, A.Asset_ID, B.RoadID, A.AssetType, B.RoadName, B.SegmentNo, C.AadtCount, C.CommVehCnt " +
@"Into [SealRegister] " +
@"From [C:ARPlantAccounting2015].ARPlntPA_2015_07-2016_06+10yrs As A " +
@"LEFT OUTER JOIN ([C:ARLinesAccounting2015].ARLnPA_2015_07-2016_06+10yrs As B " +
@"LEFT OUTER JOIN [C:ARLinesTEMP].ARLnX As C On B.Asset_ID = C.Asset_ID) On A.Parent_ID = B.Asset_ID " +
@"WHERE AssetType = 'Wearing Course'";
我需要做什么来纠正语法
[编辑]
connStr = "Provider=Microsoft.ACE.OLEDB.12.0;data Source=C:\AR\TEMP\SealRegister.mdb">
这有效:
sqlcommand = @"Select ""Plant"" As Geometry, A.Asset_ID, B.RoadID, A.AssetType, B.RoadName, B.SegmentNo, C.AadtCount, C.CommVehCnt " +
@"Into [SealRegister] " +
@"From [C:ARPlantAccounting2015ARPlntPA_2015_07-2016_06+10yrs].[ARPlntPA_2015_07-2016_06+10yrs] As A " +
@"LEFT OUTER JOIN ([C:ARLinesAccounting2015ARLnPA_2015_07-2016_06+10yrs].[ARLnPA_2015_07-2016_06+10yrs] As B " +
@"LEFT OUTER JOIN [C:ARLinesTEMP].ARLnX As C On B.Asset_ID = C.Asset_ID) On A.Parent_ID = B.Asset_ID " +
@"WHERE AssetType = 'Wearing Course'";