我收到错误"不支持关键字:'(本地);初始目录'。"

时间:2014-10-13 07:50:12

标签: c#-4.0

public static string getconnection()
{
    //string db1 = System.AppDomain.CurrentDomain.BaseDirectory + "CheckExe.accdb";
    //string Connection"Provider=Microsoft.ACE.OLEDB.12.0;DataSource=|DataDirectory|\\CheckExe.accdb";
    string Connection = "(local);Initial Catalog=School_Sharda;Integrated Security=True";
    return Connection;
}

1 个答案:

答案 0 :(得分:1)

您错过了Date Source密钥:

string Connection = "Data Source=(local);Initial Catalog=School_Sharda;Integrated Security=True";