我有以下语句在'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:\AR\Plant\Accounting\2015].ARPlntPA_2015_07-2016_06+10yrs As A " +
@"LEFT OUTER JOIN ([C:\AR\Lines\Accounting\2015].ARLnPA_2015_07-2016_06+10yrs As B " +
@"LEFT OUTER JOIN [C:\AR\Lines\TEMP].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;数据 源= C:\ AR \ TEMP \ SealRegister.mdb“
答案 0 :(得分:0)
这有效:
sqlcommand = @"Select ""Plant"" As Geometry, A.Asset_ID, B.RoadID, A.AssetType, B.RoadName, B.SegmentNo, C.AadtCount, C.CommVehCnt " +
@"Into [SealRegister] " +
@"From [C:\AR\Plant\Accounting\2015\ARPlntPA_2015_07-2016_06+10yrs].[ARPlntPA_2015_07-2016_06+10yrs] As A " +
@"LEFT OUTER JOIN ([C:\AR\Lines\Accounting\2015\ARLnPA_2015_07-2016_06+10yrs].[ARLnPA_2015_07-2016_06+10yrs] As B " +
@"LEFT OUTER JOIN [C:\AR\Lines\TEMP].ARLnX As C On B.Asset_ID = C.Asset_ID) On A.Parent_ID = B.Asset_ID " +
@"WHERE AssetType = 'Wearing Course'";