I'm getting an error connecting to a VistaDB using a connection string in the web.config file.
我在使用web.config文件中的连接字符串连接到VistaDB时出错。
It works fine using a SQLDataSource AFTER I specified the ProviderName. On another page I'm only connecting in code and
在我指定ProviderName之后使用SQLDataSource可以正常工作。在另一个页面上,我只是用代码连接
Here is the code for the connection string:
这是连接字符串的代码:
Public Function CreateConnection() As SqlConnection _connectionString = ConfigurationManager.ConnectionStrings("ConnectionString").ToString() Return New SqlConnection(_connectionString) End Function
公共函数CreateConnection()As SqlConnection _connectionString = ConfigurationManager.ConnectionStrings(“ConnectionString”)。ToString()返回新的SqlConnection(_connectionString)结束函数
Here is the error:
这是错误:
A network-related or instance-specific error occurred while establishing a connection to 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. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
建立与SQL Server的连接时发生与网络相关或特定于实例的错误。服务器未找到或无法访问。验证实例名称是否正确,以及SQL Server是否配置为允许远程连接。 (提供程序:SQL网络接口,错误:26 - 查找指定的服务器/实例时出错)
How can I resolve this error?
我该如何解决这个错误?
1 个解决方案
#1
2
You can't use a SqlConnection with a VistaDB connection string. That is the error you are getting from SQL Server - it can't find that server.
您不能将SqlConnection与VistaDB连接字符串一起使用。这是您从SQL Server获得的错误 - 它无法找到该服务器。
Use a VistaDBConnection instead.
请改用VistaDBConnection。
#1
2
You can't use a SqlConnection with a VistaDB connection string. That is the error you are getting from SQL Server - it can't find that server.
您不能将SqlConnection与VistaDB连接字符串一起使用。这是您从SQL Server获得的错误 - 它无法找到该服务器。
Use a VistaDBConnection instead.
请改用VistaDBConnection。