I have made an application in VS2012 that uses a database to store and retrieve data and I'd like to create a setup file for this application, currently I use InstallShield LE 2012.
I've tried to deploy the application with that, but when I install it in another computer it throws me an exception due to the database.
If you are getting a Null reference exception error this is normally because some place in the code there is a failure to create an object. Then at a later point the use of this object fails with a Null Exception because the object does not exist.
In this case is sounds like there is a failure to create some object that is a dependency for creating the database. I know this does not really give much more insight into why this is happening. But here are some points to look for.
Is the target PC running an SQL server, or does your Install package deploy SQL Express?
Is it a MS SQL DB or Other
Does the user that you are running the install shield under have permissions on the SQL Server to create a database?
Related
I wrote a small app to learn more about SQL and experiment with Entity Framework. On first execution, my app creates the database locally, and after that opens the existing database. So far, so good - it works pretty well on my laptop, which has SQL Server 2017 installed.
I tried copying the assemblies to my desktop machine and that also worked as expected, though SQL Server was not installed.
But when I tried copying the assemblies to another laptop, the app would not run. The exception I saw was:
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: 52 - Unable to locate a local Database
Runtime Installation. Verify SQL Server Express is properly installed
and that the Local Database Runtime feature is enabled.)
All machines are Windows 10. (Is it significant that the desktop machine has Visual Studio 2019 installed?)
I can't seem to find a post here which speaks to my problem. (I'm probably not phrasing my query well...)
Anyway, I don't want other users to be required to install SQL Server (Express, or otherwise). What do I need to include in my installation?
Can it be done more-or-less automatically by using ClickOnce deployment (a.k.a. Publishing Wizard)? Or do I need to build an .msi with Wix code?
Is SQLite a better option for this? Users of my app will not be sharing databases; each will have their own.
I have seen mention of SQL Server Compact Edition in this post: ASP.NET MVC - Switching from SQL Server Express to Compact Edition - Connection Issue, but when I tried to run this down, it seemed like this is no longer available from Microsoft. And I believe I'm already using SQL Server Express (looks like this is confirmed by the error message, above)...
At present I have worked around this problem by using ClickOnce deployment. In the near term, I would like to change the installation to include the dependencies (.NET & SQL runtimes) in the setup package, rather than downloading them at install-time.
But I wonder if SQLite would be a better long-term solution... One thing I have appreciated about SQLServer is that I can use SQLServer Management Studio to get at the database apart from the app, so I can validate what the app has done. I also think this is a good thing for users, as they will always have a second option for getting their data, if something goes wrong with the app.
Does SQLite provide any tool similar to SQLServer Management Studio for accessing the database?
SQLite is a better option as it is an embedded database. This means that it is a part of your application and doesn't require additional setup. It works well for storing per-user data that is not shared.
https://www.sqlite.org/whentouse.html
SQLite only requires its assemblies for deployment.
SQLite deployment for .net application
I'm coding a C# Console Application that connects to a database and runs some queries where my database Engine is Microsoft SQL Server 2016 and I code in Visual Studio 2015. I have already installed and activated InstallShield Limited Edition on my visual studio and I'm able to make an installation(setup) file for my C# Console Application.
I don't want to to install Sql Server on my customer's PC and attach the database to that manually, instead I want to give everything in an installation file that includes .Net framework 4.5 and my database. The first part(.Net Framework) is done by InstallShield easily, but I don't know how to attach my database to the installation file.
Please explain how to do this and if any other version of InstallShield(Express, Professional or Premier) is needed let me know and explain the steps in that version.
Note that I want to give the installation file to the customer and make every feature of the app function well after he/she installs the program without needing to do anything manually.
Sql server 2016 cannot be installed automatically as it needs to be configured by the user, he must set the instance names, permissions and so on, which makes it unusable for your scenario.
What you need to use is Sql Server LocalDB, this is a subset of Sql Server Express for your concrete scenario, something which can be installed without the need of configuration and capable of attaching a database file also without user interaction.
You can find information about LocalDB here, as you see it can be downloaded as a .msi, in this way you can add this msi to your installshield project and chain it (more info on how to chain an installer here), it will not ask to the user about complex configurations, just a simple installer. To download the .msi you get the sql server express installer on your development machine and instruct it to download media and select the LocalDB package, that will give you the .msi.
Finally you will add the database file as part of your project files, then you only need to specify on the connection string the path to the file.
I've created a custom connection manager for SSDT BI (SSIS) which will connect to an Oracle database using Oracle's managed data access library (Oracle.ManagedDataAccess.dll).
On my development machine, this connection manager, and the custom "data source" pipeline component which goes with it, will work fine. When I deploy the package to the server and try to run it, the package will always fail with an "AccessViolationException".
The server is running Windows Server 2012R2 with Sql Server 2014
So far, debugging hasn't give me much info. When I step though my code, my empty, default, constructor gets called but nothing else. As soon as it exits the constructor I get the exception. No other methods within my custom class are ever called.
Here's the information which is dumped to the windows event log.
Application: ISServerExec.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
Stack:
at Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSPackagePersist100.LoadPackageFromXML(System.Object, Boolean, Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSEvents100)
at Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSPackagePersist100.LoadPackageFromXML(System.Object, Boolean, Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSEvents100)
at Microsoft.SqlServer.Dts.Runtime.Package.LoadFromXML(System.String, Microsoft.SqlServer.Dts.Runtime.IDTSEvents)
at Microsoft.SqlServer.Dts.Runtime.Project.LoadPackage(Microsoft.SqlServer.Dts.Runtime.IProjectStorage, Microsoft.SqlServer.Dts.Runtime.Package, System.String, Microsoft.SqlServer.Dts.Runtime.IDTSEvents)
at Microsoft.SqlServer.Dts.Runtime.PackageItem.Load(Microsoft.SqlServer.Dts.Runtime.IDTSEvents)
at Microsoft.SqlServer.Dts.Runtime.PackageItem.LoadPackage(Microsoft.SqlServer.Dts.Runtime.IDTSEvents)
at Microsoft.SqlServer.IntegrationServices.Server.ISServerExec.ISServerExecutionEvents.LoadPackage(Microsoft.SqlServer.Dts.Runtime.PackageItem)
at Microsoft.SqlServer.IntegrationServices.Server.ISServerExec.ProjectOperator.StartPackage()
at Microsoft.SqlServer.IntegrationServices.Server.ISServerExec.ProjectOperator.PerformOperation()
at Microsoft.SqlServer.IntegrationServices.Server.ISServerExec.ExecuteMain.Main(System.String[])
I've run into a similar issue before. The resolution was the sql server agent not having correct permissions to use the dll file.
Possible Fixes:
Check the location of the dll on the server.
Confirm permissions to use the dll.
Sorry I can't provide more precise fixes, the DBAs at my site ended up fixing it for me and this was the summary they gave me after.
can you sketch for me the outline of the SSIS package?
I have a hunch that this problem can occur when nesting Sequence Container objects in SSIS 2008. When you create a package with SQL Business Intelligence Development Studio 2008, and nest Sequence Containers, and then upgrade the package to SSIS 2012 or greater, and then open the package in SQL Server Data Tools 2012 or greater, the package will not display the same way as it did in 2008. The outer sequence container will not be attached to anything.
I have a team working on a project. For the purpose of collaboration we are using Team Foundation Server.
Now we want to create a shared database so that each team member can connect to the database, manipulate it, and retrieve data.
I've already created a SQL Database Project and I've added it to TFS but I don't know how to connect to it from my code ?
The SQL Database Project is just a representation of the database schema and objects. It isn't a database that you "connect to".
Instead you will need a SQL server running somewhere. You might decide to run it locally on each of your dev machines or have a common server that everyone accesses. Either way, a regular SQL server needs to be installed somewhere.
This doesn't have anything to do with TFS. This is just a Visual Studio project like any other.
What exactly do you mean by "connect to it from my code"? .NET code doesn't directly interact with a database project, but can form a data access layer to interact with a database.
If you right-click on the database project in Visual Studio, there is an option to deploy (or perhaps publish, depending on the Visual Studio version). You can deploy the database project to a live database and then your .NET code can interact with that database.
This can be multiple databases. For example, your automated builds can deploy to a shared database for everyone to use, and individual developers can deploy to their local workstations for development and debugging purposes.
The Sql Database project is not a database in itself - it is a project that describes a database. You need to deploy that project (typically to an instance of Sql Server) in order to connect to it in the way you describe.
In a typical team development environment, each member of your team might have their own local instance of Sql Server, and deploy the project to it. In this way, your team members won't get in eachother's way as they create and delete data during the course of development. You will possibly also want a shared instance for a more formal testing environment.
So ultimately, what you've created is not a shared database: it's a template that a database can be created from.
i have a winform application in c#on visual studio, connected to a database in sql server 2008 and i have done a deployment to it so to use it i must install the sql server management studio and restore the database backup, so Can i when doing the deployment and setup project include or take the database backup to not need to install the SQL server management studio on the PC use this application and from the application i will take a backup from the updated database which has new records
So how do i make a deployment and setup project and embedded in it the database used so i'll not be needed to install the sql server in the PC which act as a server and the clients PCs as i want to use the application in a network?
If your database is trivial, should be accessible from a single computer and is used to store local data look to the.
http://www.microsoft.com/sqlserver/2008/en/us/compact.aspx. For sure you will need to read additional articles about how to use it and deploy it, but this should be a starting point. NOTE: you will not have stored procedures and advanced SQL Server features, but you will use the same code as you do now.
Note that if you want to restored a database from backup to an arbitrary SQL Server instance, you may encounter problems if the instance to which the backup is being restored is configured with options different than the original SQL Server instance (e.g., collation sequence, case-sensitivity, ANSI settings, etc.) If the default collation sequence is different, you may have problems with indices, for instance.
You can use sqlcmd for that, it installs with MSSQL server on client machine look here for details.
After you created bat file, you can run it from code use Process.Start
It's not the SQL Management Studio that is needed to be installed to make the program work, it's SQLServer that must be installed.
For small applications it maybe to much of work to administrate a SQLServer, in that case its better to use other database types... I used to use XML files, lately I use Sqlite, its very good no installation required. and it integrates great into Visual Studio.
Edit: If you only need to restore a .bak you could use that http://sqlbackupandftp.com/restore/ its very nice and easy, and its a very small file.