Link to home
Start Free TrialLog in
Avatar of Sonny G
Sonny G

asked on

VB.NET Application Installation with sqlserver

I have an application that I am ready to test the installation phase.

I used SqlServer2016 to develop my application but not every user will have SS2016 on their machines. I know that users can download SqlServer Express free but what do I need to put into my installation for the connection that the user will use? How do I send the database in the installation? Is there a routine that I have to add to my code so that the person installing the code enters where the database will reside?
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

What are you using to package and deploy the application? I would backup your database, and deploy the .bak file along with the application, then write code to Restore that .bak file to your server.

Advanced Installer (http://www.advancedinstaller.com/) has a free version that integrates very nicely into Visual Studio, and you can customize your install to include the .bak file. If you do that, you can capture the location where the user places that .bak file and use that when restoring the database.

Or you could simply create scripts that would create and populate the database on the end user machine. With this method, you don't have to worry where the file is located. SQL Server will create it in the default directory.
Avatar of Sonny G
Sonny G

ASKER

I am new to VS2015 and I know that an installer package is part of the UI.

I built a very simple application that includes a number of complex "technical" coding features just so that I can create a throwaway application that would contain features of applications that I have built in the past.

My throwaway application is simply an exercise to teach myself VB.net in the VS2015 UI. After I finish my UAT, I want simply create an install exe on a machine that would only have SqlExpress and see how the user would identify the location of where the database would be located.

So, the question was really twofold, You answered the physical database location mechanical solution but how do I reflect that location in my connection script? The compiled code contains the connection code which is good for me but not for the consumer of the application.

Thanks for your help!
You'd have to either (a) capture it during install (assuming you can do so using your install methods), or (b) ask the user to locate the file.

I don't use ClickOnce (which is what I believe you're referring to), but it would seem that you can deploy data as described here:

https://msdn.microsoft.com/en-us/library/d8saf4wy(v=vs.140).aspx

I'm not sure how that would apply to SQL Server files, however. Those must be attached to the SQL Server the end user would be running.
SOLUTION
Avatar of Vadim Rapp
Vadim Rapp
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sonny G

ASKER

The information provided by both of you is great!  Thanks.

Regarding the connection script, here is my code in the application:

    '****************************************
    '* Connects to the SqlServer data store *
    '****************************************
    Dim objConnection As New SqlConnection _
        ("Data Source=MAINCOMPUTER;Initial Catalog=MailingSystem;Integrated Security=True;Pooling=False")

How can my application install into a foreign computer where their Data Source will be the name of their data store? Embedded into my code is "MAINCOMPUTER". Their data store will be another name.

Thanks!
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sonny G

ASKER

Thank you!
Avatar of Sonny G

ASKER

Thanks, everyone!