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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:27:21+00:00 2026-05-27T17:27:21+00:00

Now, for every model in my MVC 3 app I create data class (in

  • 0

Now, for every model in my MVC 3 app I create data class (in separate directory) were store a code which working direct with MySQL:

public Models.Inflation Select(int id)
            {
                Models.Inflation inflation = new Models.Inflation();
                MySqlConnection connection = new MySqlConnection(ConnectionString.ConnectionStringMySQL);
                MySqlCommand command = new MySqlCommand("SELECT " +
                    "inflation.monthInf, " +
                     "inflation.indexInflation " +
                    "FROM " +
                    "inflation " +
                    "WHERE id=@id " +
                    "ORDER BY inflation.monthInf ASC",
                    connection);
                command.Parameters.AddWithValue("@id", id);
                MySqlDataReader reader = null;
                try
                {
                    connection.Open();
                    reader = command.ExecuteReader();
                    while (reader.Read())
                    {
                        inflation.ID = id;
                        inflation.Date = DateTime.Parse(reader["monthInf"].ToString());
                        inflation.IndexInflation = decimal.Parse(reader["indexInflation"].ToString());
                    }
                }
                catch (Exception ex)
                {

                }
                finally
                {
                    if (reader != null)
                        reader.Close();
                    connection.Close();
                }
                return inflation;
            } 

But this method very tedious (for every Model class I must create Select, Insert, Delete, Edit…). How to improve the development and not using Entity Framework (ORM difficult to connect in my hosting).?

  • 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-27T17:27:21+00:00Added an answer on May 27, 2026 at 5:27 pm

    You can use Microsoft Enterprise libraries. And in later stage if would like to migrate from MySql to SqlServer datebase you can do this by just changing your connection string.

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

Sidebar

Related Questions

Every now and then (ahem...) my code crashes on some system; quite often, my
In ASP.NET MVC there is Model, View and Controller. MODEL represents entities which are
I need to separate ViewModels in my MVC project from my business models (Data
Almost every time I run my MVC app, it stops with errors before getting
Background: I started to create logical database model for ASP.NET MVC web site. I
Every now and then I get an error when I set up states in
Every now and then, I bump into syntax that I've seen before, but never
Every now and again, I need to start the Django development server, and have
Every now and then I receive a Word Document that I have to display
Every now and then I need to call new[] for built-in types (usually char

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.