Deploy a project that includes entity framework and sql server 2014 - c#

I have Visual Studio 2015, and I am trying to create an installation package for a product of mine for selling purpose.
I have tried Installshield Limited Edition for Visual Studio but with that, the installer can't access the database on my client's computer.
i have installed sql server 2014 on client's computer and attatched the database file to it but i am faced with the following error
I am not sure how to add the Entity Framework library and SQL Server database as they are not picked up or accessed automatically.

From the error message you can clearly see:
.... Login failed for user 'SAWLAIN-PC...'
Your problem is a hard-coded connection string.

Related

Connect Windows Forms application with SQL Server Express

I have created a Windows Forms desktop application using Visual Studio 2019. I also created a database using SQL Server Management Studio. I connected the database with my application with connection string
"Data Source=CYBERCELL\\SQLEXPRESS;Initial Catalog=Details;Integrated Security=True;"
The application is running without any error. I published this application using Visual Studio 2019 publish wizard and installed in another computer. But I can't understand how to use and connect the database with the application in that system.
I am looking to install SQL Server in every computer. But if I install SQL Server, the server name will be different.
If you're locally installing SQL Server Express on each individual computer, you could use
.\SQLEXPRESS
or
(local)\SQLEXPRESS
as your server/instance name - this is the same on every computer. The dot . or (local) (in parenthesis) refers to the local computer, and SQLEXPRESS is the default instance name for any SQL Server Express installation.
I once stuck with this same scenario... and this is how I solved the problem,
You don't have to install SSMS or SQL server on any of your client's pc, if you follow these steps
You have to create a localDB on your application and make sure the application will connect to that localDB.(if you don't know how to connect to local db, here => Connect to LocalDB. And make sure to create tables and procedures as same as your previous database.
Follow this answer(ticked) with code(connection string)
After this, you have to install Advanced Installer to create an installer for your application (the best choice I ever chose).
Then Follow this to create an installer where you make sure to add a prerequisite of localDB (say localdb 2019) installer of your current version.
This makes your application run on any pc and only requires localdb as a prerequisite to be installed which also comes with the installer.
Make sure to leave a message not to delete localdb on the application installed location.

ClickOnce application using SQL Server database

I'm trying to learn how to create a simple application using Visual Studio IDE in C#.
I wrote a little application that uses a local SQL Server database for reading and storing data. On my machine, the program seems to work normally, but when trying to install the application on client computer it seems unable to read from the database.
I've tried to include the following prerequisites to the publish properties but it doesn't work:
Microsoft .NET Framework 4.5.2
SQL Server 2012 Express LocalDB
Any ideas about the right way to do it?
Thanks to all.
You need to install SQL Server Express LocalDB (SqlLocalDB.MSI) on the computer you are deploying your ClickOnce application to.
Selecting "SQL Server Express LocalDB" in the Prerequisites window and using "Download prerequisites from the component vendor's web site" should take care of that:
If you do that it should install the LocalDB for you and any database errors are more than likely resulting from connection string errors or leaving Integrated Security enabled.
You need to test on a target computer which does not have "SQL Server Express LocalDB" installed and verify that after the ClickOnce deployment it is installed. This will confirm that the problem is not the missing prerequisites but the database access issues...

C# with MSSQL database Project Not running in another computers

I have Developed a C# project using Visual Studio 2015 and in this project, I have used the Microsoft SQL Server 2017 Database System.
The Problem is When I tried to run my project's Setup in other computer it shows the following Message whenever I run the project after the installation in another computer.
I have tried installing the MS SQL server in other computer it is displaying the same message. What I have done wrong?? Please help me. How to run my project in any computer?
You are not connected to SQL server yet. Make sure that the SQL services are running correctly. You can check them by clicking on My Computer->Manage->Services And Applications->Services.

Deploy c# application with MySql database in VS 2015 using VS Publish Method

I have created a C# application with a MySql database in Visual Studio 2015. I want to deploy my project using the publish method in Visual Studio including the database. I do not know how to deploy the MySQL database so I can use my application on the target computer without installing any MySQL server or database manually. I want that when I install my application on the target computer, it will auto detect the database and work.
Please help. Thanks.
If you use database storage as server means there is no need to install SQL and mySql Database Software. But you need to configure database in webconfig

how to automatically create aspnetdb.mdf to store administration security data

i was trying the MVC Music Store project but i encountered a problem when going to the administration tool, it says
There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store.
The following message may help in diagnosing the problem: Unable to connect to SQL Server database.
I searched online and tried numerous ways and found out it is because i don't have sqlserver express edition, so i can't use the AttachDbfile feature to auto create aspnetdb.msd file to store administration data
as i stated in the title, the truth is i installed sql server 2012 express first, but because i need reporting services i then installed the full sqlserver 2012, but i didn't create a new instance when installing instead i selected adding new feature to existing instance, so why does the VS say i don't have the express version now, i am totally buffled
does this mean if i want to use the app_data file feature again, i have to install sql server 2012 express as a new instance again?
SQL Server Express Edition is the only edition of SQL Server that supports User Instances. Thus, if you want to use a User Instance and do not have SQL Server Express Edition installed, you must install SQL Server Express Edition.
If you have a "full" version of SQL Server, I would suggest using the ASP.NET SQL Server Registration Tool (aspnet_regsql.exe) to create the equivalent of the aspnetdb.mdf database.
Edit:
As indicated in the answer to Can we install Express edition and Standard edition of SQL Server on same PC User?, it is possible to install both SQL Server Express Edition and a "full" version of SQL Server on the same computer.
However, it sounds like you performed an Edition Upgrade which replaced SQL Server Express Edition with the "full" version of SQL Server. If this is the case and you still want to use a User Instance, install SQL Server Express Edition again.
If you are not sure which edition(s) of SQL Server is installed, see How to determine the version and edition of SQL Server and its component.

Categories