How to integrate a MySQL database with a C # application?

1

I am a beginner in database and I have a simple C # application of registers and I want to use the MySQL database to store the data.

I have MySQL Server installed and I usually use the "command-line client" where I already have a test table created "account" containing the columns: id, user, and password. db="test".

* I have already done the assignment of the "MySql.Data.MySqlClient connector" reference to the class where I will perform operations with the database.

Questions:

  • How can I configure the connection string correctly?
  • After the string has been set and the connection has been established, how can I integrate the database into the final C # project so I can distribute it normally "executable" or even move the locale project without having problems with the address of the MySQL developer machine?
  • Following question 2, is there a way to keep the database within the C # project, where can I modify it gradually in different locales without having any problems regarding the change of address in the string?
  • How to modify and update the tables in a future update in the project created, how can I modify it in my sql server (update the file while maintaining the connection string)?
  • asked by anonymous 02.04.2015 / 17:49

    1 answer

    2

    How can I configure the connection string correctly?

    You can use a udl file for this . The MySQL client needs to be properly installed on your machine.

    After the string has been set and the connection has been established, how can I integrate the database into the final C # project so I can distribute it normally "executable" or even move the locale project without having problems with the address of the MySQL developer machine?

    The best way is to manage your project using packages. In the case of C #, the solution is called NuGet . The MySQL package in NuGet is accessible here .

    Your concern will only be to copy the files to the destination machine, without worrying about installations and things like that.

    Following question 2, is there a way to keep the bank within the C # project, where, can I modify it gradually in different locales without having any problems regarding the change of address in the string?

    Yes, but this will cause you to abandon MySQL and use a database whose format is local. There are two great database technologies for this:

    How to modify and update tables in a future update in the project created, how can I modify it in my sql server (update the file while maintaining the connection string)?

    You can use a Data Abstraction Framework to do this incrementally, such as EntityFramework .

        
    02.04.2015 / 18:00