[英]Visual Studio QueryFirst Extension
對於那些使用 QueryFirst ( https://www.codeproject.com/tips/1108776/queryfirst-world-first-implementation-of-the-domin )
如何將其連接到 Wampserver MySQL 數據庫? 我已將數據庫連接到我的項目
連接到數據庫
在
服務器瀏覽器
但是使用 QueryFirst 的連接圖標,我無法將我的數據庫附加到 Query1.sql。
這是一個示例供您參考。
在你的 app.config 中,你需要一個像這樣的連接字符串......
<add name="QfDefaultConnection" connectionString="Server=localhost;Database=dbname;Uid=root;Pwd=Dimosoftware=1;AllowUserVariables=True;" providerName="MySql.Data.MySqlClient"></add>
和代碼...
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);
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.