public static bool LoadCallstackComment(int callstack_uid, ForEachCallstackComment func) { using (SqlConnection conn = new SqlConnection(connectionString)) { try { conn.Open(); SqlCommand cmd1 = new SqlCommand("usp_select_comment", conn); cmd1.CommandType = CommandType.StoredProcedure; cmd1.Parameters.AddWithValue("@callstack_uid", callstack_uid); SqlDataReader reader = cmd1.ExecuteReader(); while (reader.Read()) { string author = reader.GetString(0); string comment = reader.GetString(1); DateTime created = reader.GetDateTime(2); func(author, comment, created); } reader.Close(); } catch (System.Exception) { return(false); } } return(true); }
public static bool LoadCallstackComment(int callstack_uid, ForEachCallstackComment func) { using (SqlConnection conn = new SqlConnection(connectionString)) { try { conn.Open(); SqlCommand cmd1 = new SqlCommand("usp_select_comment", conn); cmd1.CommandType = CommandType.StoredProcedure; cmd1.Parameters.AddWithValue("@callstack_uid", callstack_uid); SqlDataReader reader = cmd1.ExecuteReader(); while (reader.Read()) { string author = reader.GetString(0); string comment = reader.GetString(1); DateTime created = reader.GetDateTime(2); func(author, comment, created); } reader.Close(); } catch (System.Exception) { return false; } } return true; }