I used my connection string as
Data Source=.\SQLEXPRESS;Initial Catalog=dbTestSharing;Integrated Security=True
On development computer it works fine. But when I made setup (using Visual Studio) and installed on my home computer, it says
“Can not connect the database dbMyTest requested by the login, the
login failed. Login failed for user p4\admin”
My questions are:
- I did not include the database to setup. Do I need to do so?
- Does my user need to make servers and instances when SQL Server to run my application?
I installed another application based on SQL Server Express, that did not have anything like that.
Please guide.
You’re not very clear what you’re asking and what you’re trying to do…..
The SQL Server instance name is chosen at the time of the installation and cannot be changed after the installation. So what are you trying to do here???
Before a user can use your application that requires SQL Server, yes, he or she will have to install SQL Server. And if you require a specific instance name, you need to describe that in an installation manual or readme file or something!
But honestly: you shouldn’t require a specific instance name – the user should be able to pick that instance name himself and just adapt your connection string as needed.
Update:
My questions are:
No – you don’t have to. If you make it very clear in your installation guide / readme.txt file that a SQL Server instance is required as a prerequisites, then it’s up to the user to make sure he/she has a SQL Server instance ready before they install your application.
However, it would be helpful and is often almost expected that you would include at least e.g. a SQL Server Express MSI file so that the user – if he doesn’t already have a server installed – can do the installation right from your app, instead of having to hunt and search for a SQL Server before installing your application.
Yes – your connection string shows that you’re connecting to a SQL Server instance – so there must be a SQL Server instance available for this.
If you don’t want this, you would need to switch to e.g. SQL Server Compact Edition which contains all data in a single
.sdffile and all the code for accessing the database is available in a set of DLLs that you can ship with your application – no prior installation needed.