using C#: What is MDF and how to connect ?

Code with C | Programming: Projects & Source Codes Forums ASP.NET using C#: What is MDF and how to connect ?

This topic contains 3 replies, has 1 voice, and was last updated by  Adelaid 2 years, 5 months ago.

  • Author
  • #11152


    Can anyone tell what is an mdf format database?
    what are the codes to connect to such a database and what is the best database to connect to application?

  • #11153


    MDF is the format that Microsoft Access uses. You can set up an ODBC connection, or with Visual Studio I think there’s a way to establish a connection via some GUI options. As for actual code, I haven’t touched .NET in ages, so I have no idea Smile

    The best database is a tricky question, because that depends on scalability, cost, timelines, etc. For a simple setup, try a real database like MySQL or PostgreSQL.

  • #11154


    MDF is not Access, it is MS SQL server database. (Master Data File)

    When you create a database in MSSQL Server it will create one MDF file and one LDF file, the LDF is a log file.

    when you create a database with SQL Server Express, the MDF File will be added to your ASP.Net application.

    When you start working with ASP.Net, the best choice in DB Server is a SQL Server database. You can use MSSQL Express, or Compact databases.

    Advantage is that you can use Entity Framework and that is in my opinion the fastest way to set up a database and a good way to use that database, especially for a beginner.

  • #11155


    Use the ADO.NET EntityFramework to make your life a lot easier.

    Anyway, if you’re going to make something that involves multiple users and multiple queries being executed on the database at any given time, don’t use Access or you’ll run into concurrency issues sooner or later. Obviously MSSQL works best with .NET, as they’re both Microsoft technologies and they tend to give that little bit of extra compatibility with their own products. However, MySQL or any other ODBC database should work just fine.

You must be logged in to reply to this topic.