Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8048157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:20:38+00:00 2026-06-05T06:20:38+00:00

Originally this method returns false only in case of ANY problems regardless of their

  • 0

Originally this method returns false only in case of ANY problems regardless of their type. I’m wondering will applying using statement break the logic if exception

Is it ok to return true value from the using statement in this manner:

    try
    {

        Measurements.DeleteAllMeasurements(ID);
        string query = "DELETE FROM `Narz` WHERE `NAZk_1_ID`=@NAZ_ID";
        using(OleDbConnection strukturaConnection = new OleDbConnection(CommonConnectionString + DbPath + strStructureMdb))
            {
                using (OleDbCommand command = new OleDbCommand(query, strukturaConnection);)
                    {

                        command.Parameters.Add("@NAZ_ID", OleDbType.Numeric, 50);
                        command.Parameters["@NAZ_ID"].Value = ID;
                        command.ExecuteNonQuery();
                        return true; 
                    } 
            }
    }
    catch (Exception ex)
    {
        Logger.LogError(ex);
        return false;
    }

Or I should return false in another way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T06:20:40+00:00Added an answer on June 5, 2026 at 6:20 am

    All the using statement does is implicitly call the instance’s implementation of IDisposable.Dispose() at the end of the code block.

    Unless you are returning a reference and the Dispose() method happens to manipulate it, then the two concerns are completely unrelated.

    In short, it doesn’t matter what value you return from within a using statement.

    Edit: About what your method “should return”: We don’t have enough information to know this. We don’t even know what the name of the method is. And we don’t know by what other objects or aspects of the application the method will be used. The return value should be meaningful to its caller, and effectively communicate the result of the operation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm curious why is method fillInStackTrace of java.lang.Throwable public? This method replaces original stack
I originally started this question in another thread, but that thread was sorta, kinda
$_SESSION[{'\'testingrecord'.$testingrecordsfec.'\''}] this originally looked like this ${'testingrecord'.$testingrecordsfec} but I need to add the variables
Update I don't think I was clear enough when I originally posted this quesion.
A co-worker asked about some code like this that originally had templates in it.
EDIT: This post was originally specific to ASP.NET, but after thinking about it I'm
Note this question was originally posted in 2009, before C++11 was ratified and before
This question was originally asked for Android 1.6. I am working on photos options
I originally used JQuery for this project, but now I'm having to use Prototype,
This code comes from a tutorial so it's not originally my own work. What

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.