I have a website. My database is MySQL and now I want to write a program with C# that the user can use this app to upload their file to my website
How can I connect a C# program in Windows with a MySQL database on a web server?
|
You can use Entity Framework with MySql connector. Here's tutorial how to use it: http://dev.mysql.com/doc/refman/5.1/en/connector-net-tutorials-entity-framework-winform-data-source.html As alternative you can use NHibernate: http://www.codeproject.com/Articles/26123/NHibernate-and-MySQL-A-simple-example Also, as SamiHuutoniemi mentioned, you can use MySql connector without ORM, by simply using data reader: http://dev.mysql.com/doc/refman/5.0/es/connector-net-examples-mysqldatareader.html Update: Ups, looks like I misunderstood the question. Short answer is - you don't wish to communicate directly with your website's database from desktop, as it involves many issues, one of them is security - you will need to open your database access from outside. I would suggest to make a page (web service) on your existing website that would accept requests from c# client and transform those requests into actions with database. |
|||||||||||||||||||||
|
If you do not use Entity Framework, you can also download Oracle's .NET connector. |
|||
|
You can use an OleDbConnection to connect to mysql: For example:
Here you can find more useful information. |
|||||||||
|