private static string ConnectStr()
{
string connectStr = "Server="
+ "127.0.0.1" + ";port=3306;DataBase="
+ "dbtest1" + ";persist security info=True;user id="
+ "root" + ";password="
+ "123456" + ";Allow Zero Datetime=true;Allow User Variables=True;Charset=utf8;";
return connectStr;
}
public DBContext()
//: base("name=connectionString")
: base(ConnectStr())
{
}
这里居然报 "不支持关键字: “port”。"
做过的请回答
DbContext
nameOrConnectionString
No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'. Make sure the provider is registered in the 'entityFramework' section of the application config file. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.
觉得是应该要指定 providerName=MySql.Data.MySqlClient;
支持(
1
)
反对(
0
)
园豆:297
(菜鸟二级)
2017-04-21 11:51