When I set up my VB.net program to read from a local MDF database file (SQL), it tells me that I need remote connections. Details follow:
I have a Visual Studio vb.net
application. It needs a database, so I downloaded SQL Express and ran a script to add my database. This worked fine. Then I wanted to send my program to a colleague, and I thought I should copy the database MDF and LDF files to the App_Data folder of the program, and then use a connection string that can read the MDF.
The connection string seems to be OK:
Server=.\SQLExpress;AttachDbFilename=C:\gideonwroteprograms\EchoTheory\Echo
Theory\bin\Debug\App_Data\EchoDatabase.mdf;Database=EchoDatabase;Trusted_Co
nnection=Yes;
but I get a message saying I now need to allow remote connections (which I regard as a security risk).
The message is:
System.Data.SqlClient.SqlException
HResult=0x80131904
Message=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)
Source=.Net SqlClient Data Provider
User contributions licensed under CC BY-SA 3.0