To those, who use QueryFirst ( https://www.codeproject.com/tips/1108776/queryfirst-world-first-implementation-of-the-domin )
How to connect it to a Wampserver MySQL database? I have connected the db to my project with
Connect to Database
in
Server Explorer
But with the Connect icon of QueryFirst I cannot attach my db to Query1.sql.
Here is a sample for your reference.
In your app.config, you'll need a connection string like this...
<add name="QfDefaultConnection" connectionString="Server=localhost;Database=dbname;Uid=root;Pwd=Dimosoftware=1;AllowUserVariables=True;" providerName="MySql.Data.MySqlClient"></add>
and code...
using System;
using System.Configuration;
using System.Data;
using MySql.Data.MySqlClient;
namespace YourApp
{
class QfRuntimeConnection
{
public static IDbConnection GetConnection()
{
return new MySqlConnection(ConfigurationManager.ConnectionStrings["QfDefaultConnection"].ConnectionString);
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.