public static string GetFileName(Guid id) { using (SqlConnection connection = new SqlConnection(Config.ConnectionString)) { connection.Open(); using (SqlCommand cmd = new SqlCommand("SELECT fileName FROM Documents WHERE id = @id", connection)) { cmd.CommandTimeout = Config.CommandTimeout; cmd.AssignParams("id", id); return (string)cmd.ExecuteScalarRetryOnDeadlock(); } } }