Beispiel #1
0
        //Unallocated --Connection oriented
        public DataTable Select(string sql)
        {
            DataTable dt = new DataTable();

            try
            {
                SqlConnection  conn    = DALConnManager.Open();
                SqlCommand     command = new SqlCommand(sql, conn);
                SqlDataAdapter adp     = new SqlDataAdapter(command);
                adp.Fill(dt);
                conn.Close();
            }
            catch (Exception ex)
            {
                throw;
            }
            return(dt);
        }
Beispiel #2
0
        public bool Update(string sql)
        {
            bool status      = false;
            int  rowAffected = 0;

            try
            {
                SqlConnection conn    = DALConnManager.Open();
                SqlCommand    command = new SqlCommand(sql, conn);
                rowAffected = command.ExecuteNonQuery();
                DALConnManager.Close(conn);
                if (rowAffected > 0)
                {
                    status = true;
                }
            }
            catch (SqlException ex)
            {
                throw;
            }
            return(status);
        }