日期:2014-05-17 浏览次数:21890 次
DbCommand cmd = PkDbConnection.MainConn.CreateCommand(); cmd.CommandText = "update recharge_order set status=@status,ali_trade_no=@aliOrderSeq,confirm_time=@confirmTime where id=@order_id and status!=@curStatus"; cmd.Connection = PkDbConnection.MainConn; DbParameter pa1 = PkDbConnection.MainFactory.CreateParameter(); pa1.DbType = DbType.Int16; pa1.ParameterName = "@status"; pa1.Value = (int)status; DbParameter pa2 = PkDbConnection.MainFactory.CreateParameter(); pa2.DbType = DbType.Int64; pa2.ParameterName = "@order_id"; pa2.Value = orderId; DbParameter pa3 = PkDbConnection.MainFactory.CreateParameter(); pa3.DbType = DbType.Int64; pa3.ParameterName = "@aliOrderSeq"; pa3.Value = (int)OrderStatus.success; DbParameter pa4 = PkDbConnection.MainFactory.CreateParameter(); pa4.DbType = DbType.AnsiString; pa4.ParameterName = "@curStatus"; pa4.Value = aliOrderSeq; DbParameter pa5 = PkDbConnection.MainFactory.CreateParameter(); pa5.DbType = DbType.AnsiString; pa5.ParameterName = "@confirmTime"; pa5.Value = confirmTime; cmd.Parameters.Add(pa1); cmd.Parameters.Add(pa2); cmd.Parameters.Add(pa3); cmd.Parameters.Add(pa4); cmd.Parameters.Add(pa5); // throw new Exception(cmd.Parameters.ToString()); return cmd.ExecuteNonQuery();