日期:2014-05-19  浏览次数:20659 次

oledb连接方式中,绑定变量如何做?
如   SELECT   *   FROM   Customers   WHERE   CustomerID   =:CustomerIDvalue  
如何通过参数名叫把CustomerIDvalue   传进去

------解决方案--------------------
oledbcommand oleCmd=new oledbcommand();
oleCmd.CommandText= "SELECT * FROM Customers WHERE CustomerID =@CustomerIDvalue ";
oleCmd.Parameter.Add(new Parameter( "@CustomerIDvalue ",CustomerIDvalue));
然后执行oleCmd用DataReader或DataSet接收记录
------解决方案--------------------
按着顺序写就行了
com.Parameters.Add( "? ",类型).Value = "XXX ";