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 8351885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:47:05+00:00 2026-06-09T08:47:05+00:00

I wanna to know ,if there’s a difference between : IfxDataReader ifxDataReaders = ifxCommand.ExecuteReader();

  • 0

I wanna to know ,if there’s a difference between :

IfxDataReader ifxDataReaders = ifxCommand.ExecuteReader();
                    using (ifxDataReaders)
                    {
                        if (ifxDataReaders.Read())
                        {
                            item = (int)ifxDataReaders[0];
                        }
                        ifxDataReaders.Close();
                    }

  using(IfxDataReader ifxDataReaders = ifxCommand.ExecuteReader())
                         {

                            if (ifxDataReaders.Read())
                            {
                                item = (int)ifxDataReaders[0];
                            }
                            ifxDataReaders.Close();

                         }
  • 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-09T08:47:07+00:00Added an answer on June 9, 2026 at 8:47 am

    The tempting statement is to say “the first one won’t dispose”, but it will.

    The second tempting statement is to say “the first one won’t dispose if ExecuteReader throws an exception”, but in this case neither will dispose.

    If an error occurs in ExecuteReader, in both instances ifxDataReaders will not have been assigned so the Dispose call will never resolve anyway. As an aside, the call to Close is not actually required.

    Dispose will be called in both instances and I believe in the same circumstances.

    Variable scope will change. In the second instance, ifxDataReaders is scoped to the using whereas in the first ifxDataReaders can be used after the using (although, you’d be using a disposed object at this point).

    The second form is preferred, to me it seems more explicit and is more readable.

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

Sidebar

Related Questions

There is previous post about difference of @synthesize and @dynamic. I wanna to know
I wanna know if there is any way to know where the function currently
I just wanna know if there exists simple drawer (move up and down certain
I am new to LINQ and just wanna know; is there any application in
I built a custom template tag and I wanna know if there is a
I wanna know if there is a function that is called directly after the
I wanna know if there exists conceptual framework or documented techniques to study how
Hello Everybody there. I wanna know if there is a command of set of
This is a noob question, but I wanna know why there are different encoding
I wanna know where is the best place to put the ini_set() functions, because

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.