日期:2014-05-17  浏览次数:21297 次

至少一个参数没有被指定值。
 
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\\InspectionSystem.mdb");
conn.Open();
OleDbCommand InsertCommand = conn.CreateCommand();
string sql = "update temp as a,twzd as b set a.[加油站点]=b.[加油站点],a.[巡检点]=b.[巡检点],a.[巡检员编号]=b.[巡检员编号] where temp.[UID]=twzd.[UID] ";
OleDbCommand myCommand = new OleDbCommand(sql, conn);
myCommand.ExecuteNonQuery();
myCommand.ExecuteNonQuery();
conn.Close();

sql语句哪写的不对了?老是提示至少一个参数没有指定。。。

------解决方案--------------------
更新多个表
update [表1] set [列名]=b.[列名]
FROM [表1] a,[表2] b
where a.[关联列]=b.[关联列]


或者使用inner join
------解决方案--------------------
语法不正确


--正确做法
SQL code

    update a set a.[加油站点]=b.[加油站点],a.[巡检点]=b.[巡检点],a.[巡检员编号]=b.[巡检员编号] from temp as a inner join twzd as b on a.[UID]=b.[UID]
   
   --其他条件则加 where a.XX=9 等