Access 批量删除
string cmdText = "Delete * From [Product] Where ProductID = @ProductID ";
OleDbCommand dbCmd = new OleDbCommand(cmdText, dbConn);
dbCmd.Parameters.Add(new OleDbParameter( "@ProductID ", OleDbType.LongVarWChar));
dbCmd.Parameters[ "@ProductID "].Value = ProductID;
我监视ProductID== 1,2,4,5
不执行删除呢 ? 请问是什么原因?
------解决方案--------------------可能数据类型不对把
------解决方案--------------------string cmdText = " Delete * From [Product] Where ProductID in @ProductID ";
试试
------解决方案--------------------执行dbCmd.ExecuteNonQuery()了吗?
-------------------------------
爱读在线收藏夹 www.addtoo.net
-------------------------------
------解决方案--------------------我监视ProductID== 1,2,4,5
----------------
是其中一个还是就是这格式?如果就是这格式改为:
string cmdText = "Delete * From [Product] Where ProductID in( @ProductID) ";
OleDbCommand dbCmd = new OleDbCommand(cmdText, dbConn);
dbCmd.Parameters.Add(new OleDbParameter( "@ProductID ", OleDbType.LongVarWChar));
dbCmd.Parameters[ "@ProductID "].Value = ProductID;