C# 4.0 “我犯了错误”;不支持关键字:';(本地);初始目录'&引用;
您缺少C# 4.0 “我犯了错误”;不支持关键字:';(本地);初始目录'&引用;,c#-4.0,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 Conn
日期源
键:
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;
}
但这次我再次遇到的错误是“在建立到SQL Server的连接时发生了与网络相关或特定于实例的错误。找不到或无法访问该服务器。请验证实例名称是否正确,以及SQL Server是否配置为允许远程连接。(提供程序:命名管道提供程序,错误:40-无法打开到SQL Server的连接)@KapilKaushal:这意味着连接字符串的语法在实际尝试连接时是正确的。连接失败,原因可能是您试图访问一个没有名称的命名实例,或者需要为这种连接配置数据库服务器。
string Connection = "Data Source=(local);Initial Catalog=School_Sharda;Integrated Security=True";