using (SqlConnection conn = GetSQLConnectiion(repositoryID)) { using (SqlCommand comm = new SqlCommand("select *from Content_Content", conn)) { try { using (SqlDataReader reader = comm.ExecuteReader()) { while (reader.Read() && currentDirectorySize > targetSize) { try { //do somthing.... StringBuilder query = new StringBuilder("update Content_Content SET OnCache = 0 where ItemID = '"); query.Append(ItemID.ToString()); query.Append('\''); using (SqlTransaction transaction = conn.BeginTransaction(IsolationLevel.Serializable)) { using (SqlCommand comm1 = new SqlCommand(query.ToString(), conn, transaction)) { comm1.Transaction = transaction; count += comm1.ExecuteNonQuery(); transaction.Commit(); } } } catch { } } } } catch { } } }
reader
SqlTransaction transaction
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)