简体   繁体   English

使用ADO.net从MS Access数据库读取内容,并尝试将值插入SQL Server表中

[英]Reading content from MS Access db using ADO.net and trying to insert the values into a SQL Server table

I'm using an OleDb connection to read a table in MS Access. 我正在使用OleDb连接来读取MS Access中的表。 I've closed the connection and I'm trying to insert the values retrieved into a SQL Server table using Entity Framework. 我已关闭连接,并尝试使用Entity Framework将检索到的值插入SQL Server表中。

While establishing the connection to SQL Server, I'm getting an error: 建立与SQL Server的连接时,出现错误:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. 建立与SQL Server的连接时发生与网络相关或特定于实例的错误。 The server was not found or was not accessible. 服务器未找到或无法访问。 Verify that the instance name is correct and that SQL Server is configured to allow remote connections. 验证实例名称正确,并且已将SQL Server配置为允许远程连接。 (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (提供者:SQL网络接口,错误:26-指定服务器/实例时出错)

The error message is crystal clear: the server was not found. 错误消息非常清晰:找不到服务器。 So, take this two steps. 因此,请执行以下两个步骤。

  1. Verify your connection string for misspelled server name. 验证您的连接字符串是否包含拼写错误的服务器名称。

  2. Verify your SQL Server instance is accepting connections from network, what is disable by default. 确认您的SQL Server实例正在接受来自网络的连接,默认情况下处于禁用状态。

Go to: 去:

Start > All Programs > SQL Server 2005 > Configuration Tools > SQL Server Surface Area Configuration 开始>所有程序> SQL Server 2005>配置工具> SQL Server外围应用配置器

  • Click on Surface Area Configuration for Services and Connections 单击用于服务和连接的外围应用配置

  • Select the instance that is having a problem > Database Engine > Remote Connections 选择有问题的实例>数据库引擎>远程连接

  • Enable local and remote connections 启用本地和远程连接

  • Restart instance 重新启动实例

See this article: 看到这篇文章:

http://www.sswug.org/articlesection/default.aspx?TargetID=44331 http://www.sswug.org/articlesection/default.aspx?TargetID=44331

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM