views:

410

answers:

1

I'm getting an error connecting to a VistaDB using a connection string in the web.config file.

It works fine using a SQLDataSource AFTER I specified the ProviderName. On another page I'm only connecting in code and

Here is the code for the connection string:

Public Function CreateConnection() As SqlConnection _connectionString = ConfigurationManager.ConnectionStrings("ConnectionString").ToString() Return New SqlConnection(_connectionString) End Function

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)

How can I resolve this error?

+2  A: 

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.

Use a VistaDBConnection instead.

Jason Short