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

  • Home
  • SEARCH
  • 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 6199789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:15:00+00:00 2026-05-24T04:15:00+00:00

I am new Programmer. In my Comp. I am the Only Programmer. So I

  • 0

I am new Programmer. In my Comp. I am the Only Programmer. So I have many Questions in my Mind.

In my Project i am using Below Code For add.

MySqlConnection connection = new MySqlConnection(MyConString);
MySqlCommand command = connection.CreateCommand();
MySqlDataReader Reader;
command.CommandText = "select * from " + datatable + " where code='" + textBox1.Text + "'";
connection.Open();
Reader = command.ExecuteReader();
while (Reader.Read())
{
    already = 1;
}
connection.Close();

Is this Correct Way. Or DAL, Stored Procedure, 3 tire Architure Which is most effective. And What standard Code is maintain in Companies.

I am doing Project and Got Solutions Also. But I don’t know this way is Correct or Not.

I think Most of you understand my problem?.

Thanks in Advance….

  • 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-05-24T04:15:02+00:00Added an answer on May 24, 2026 at 4:15 am

    To ensure that connections are always closed, open the connection inside of a using block. as shown in the following code fragment. Doing so ensures that the connection is automatically closed when the code exits the block.

    using (SqlConnection connection = new SqlConnection(connectionString))
        {
            connection.Open();
            // Do work here; connection closed on following line.
        }
    

    This is a part of Connection Pooling. And it is one of the good way of doing Sql connection.

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

Sidebar

Related Questions

New programmer- I have created a function to add a user to a database.
i am a new programmer in visual studio (using the 2008 version) i have
I am a very new programmer, I have made a couple basic applications, however
We have 2 new GIS programmer/analyst in our department (new to programming and ArcObjects)
I'm a new Python programmer who is having a little trouble using 'self' in
So, I am a fairly new programmer working towards an undergraduate Comp Sci degree
relatively new programmer here. Look at the two classes defined below. I'd like to
I am a new programmer... i have following problem.. Terminating app due to uncaught
resize a image in table view cell... i am new programmer by this code
hi i am a new programmer i have created an app of my own.

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.