how to connect F# to MySQL database?
Hello I am a newbie using F# and MySQL. I have a project that needs to retrive data from mySQL database.So far, i installed 开发者_StackOverflow中文版wamp, mySQL, mySQL connector, php. I don't know how to contribute F# and mySQL. Can you please give me a piece of information about the steps .
Thanks,
You need a MySQL connector for .NET, this one, for example.
let connectionStr = "Data Source=localhost; Port=3306; User ID=root; Password=q1w2e3;"
let connection : IDbConnection = upcast new MySql.Data.MySqlClient.MySqlConnection(connectionStr)
See System.Data documentation for detailed information.
Hope this is helpful.
F# works with the normal .NET class libraries. So any .NET MySQL connector will work.
For example, this on here: http://dev.mysql.com/downloads/connector/net/
精彩评论