Hi,
How do you go about creating a connection to a mysql database ?
Can this be done with the use of ini files etc ? so if conections change a file can be modified rather than the program update.
Printable View
Hi,
How do you go about creating a connection to a mysql database ?
Can this be done with the use of ini files etc ? so if conections change a file can be modified rather than the program update.
You can use OleDb to connect to MySQL, or you may prefer to get a MySQL-specific data connector. There is a link to one in my signature.
The ConnectionString property of any ADO.NET connection is a dynamic property, which means that it has in-built support to be read from the application config file. Edit the DynamicProperties section in the properties window for the connection and it will be automatically stored in the config file, which will be created if necessary, and then read at run time without further intervention. You can then edit the config file by hand at each installation as it's just XML.
Finally, can I recommend more descriptive thread titles in future. You'll notice that most give an indication of what the thread is about.
My appologies,
I will remember this for next time thanks, You mention using the MySQL -specific data conector and then in the paragraph you talk about ado do i use both or just one ?
I was wondering if you could help me as well i have downloaded the 101 samples from you sig but they are saying they are missing files and can not open
ADO.NET is the preferred method of data access for .NET applications. The MySQL data connector implements the same interfaces as all the data connectors that are included in the .NET Framework, so it IS ADO.NET. For instance, the OleDbConnection, SqlConnection, OracleConnection and OdbcConnection classes included in the .NET Framework all implement the IDbConnection interface, as does the MySqlConnection that comes with the library I recommended. You can basically use any ADO.NET example for any Data namespace and simply substitute the corresponding classes from the appropriate namespace. You may also like to visit www.connectionstrings.com for the appropriate connection string. Make sure you use the correct one for the connector you are using.
With regards to the 101 samples, are you sure you downloaded the correct version? I've never had an issue opening one and I'm not aware of anyone else who has either. You should be opening the SLN files.
thanks