public static object GetScalar(string SQL) { MasterDal oDal = new MasterDal(); object obj = oDal.ExecuteScalar(SQL); oDal.Dispose(); oDal = null; return(obj); }
public static long ExecuteQuery(string SQL, bool IsPKID) { MasterDal oDal = new MasterDal(); long intRet = oDal.ExecuteNonQuery(SQL); if (IsPKID == true && (int)intRet > 0 && SQL.ToUpper().IndexOf("INSERT ") >= 0) { intRet = Convert.ToInt32(oDal.ExecuteScalar("Select SCOPE_IDENTITY()")); } oDal.Dispose(); oDal = null; if (intRet >= 0) { //DSExceptions.Messages.Add("", "Data saved", ExceptionType.Information); return(intRet); } else { //DSExceptions.Messages.Add("", "Some error occured to ExecuteQuery", ExceptionType.Information); return(intRet); } }