public static int Execute(String sql, IDbConnection cn) { logger.Info(LoggerUtil.SqlPrefix + "execute sql : " + sql); IDbCommand cmd = DataFactory.GetCommand(sql, cn); int result = cmd.ExecuteNonQuery(); logger.Info("affected : " + result); return(result); }
public static Object ExecuteScalar(String sql, IDbConnection cn) { Object result = null; logger.Info(LoggerUtil.SqlPrefix + "execute sql:" + sql); result = DataFactory.GetCommand(sql, cn).ExecuteScalar(); if (result == DBNull.Value) { return(null); } return(result); }
public static IDataReader ExecuteReader(String sql, IDbConnection cn) { logger.Info(LoggerUtil.SqlPrefix + "execute sql:" + sql); return(DataFactory.GetCommand(sql, cn).ExecuteReader()); }