0

I tried making a setup project and followed some answers I found, but when I rebuild the project it always seemed to fail because I clicked the radio button "Download prerequisites from the same location as my application". When I open the setup it's just blank. I had to click the "Download prerequisites from component vendor's website" radio button just so the setup just works.

However, every time I transfer my app onto my laptop and try to register, I always get the

The server was not found" error (full error is below).

I have a feeling I just did something wrong with my connection string, which is just this:

ReadOnly connection As New SqlConnection("Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\AladeenDatabase.mdf;Integrated Security=True")

I saw somewhere that if the database works fine on the development computer, it should work fine when installed on another computer. But it's always this 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: 50 - Local Database Runtime error occurred. The specified LocalDB instance does not exist.

1 Answer 1

1

There's nothing to do in relation to the installation. If the MDF data file is in the same folder as your program EXE then your app is working.

That said, your connection string is assuming that the machine your application is installed on has a SQL Server LocalDB instance name MSSQLLocalDB installed. If it doesn't, the connection can't be made. You need to make sure that any machine you install on has such an instance or else store your connection string external to the program, e.g. in the config file, so that it can be edited on each target machine and the Data Source set to the name of an instance that does exist. Your application relies on SQL Server so SQL Server has to be present and you have to refer to an instance that exists.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.