Click here to Skip to main content
15,887,988 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I developed an application(winform) that use database sqlite3. I need to create the .exe file for the application and the database to install it on another machine using the Visual Studio tool 2012 ( InstallShield Limited Edition).the path of the database (C:\Users\A\Documents\myfirstdatabase.db3 ) so how deploy the application with the database sqlite3 ?

C#
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraBars;
using DevExpress.XtraBars.Ribbon;
using DevExpress.XtraBars.Helpers;
using DevExpress.Skins;
using DevExpress.LookAndFeel;
using DevExpress.UserSkins;
using System.Data.SQLite;
using System.IO;

namespace mysqlite
{
    public partial class Form1 : RibbonForm
    {
        public Form1()
        {
            InitializeComponent();
        }

        SQLiteConnection cn=new SQLiteConnection("data source=C:\\Users\\A\\Documents\\myfirstdatabase.db3");
        SQLiteCommand cmd = new SQLiteCommand();    

        private void Form1_Load(object sender, EventArgs e)        
        {      
            this.employeeTableAdapter.Fill(this.myfirstdatabase.db3DataSet.Employee);
            cn.Open();            
        }       

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            try
            {
                cmd.CommandText = "select from Employee";
                cmd.Connection = cn;      
                cmd.ExecuteNonQuery();

                this.employeeTableAdapter.Fill(this.myfirstdatabase.db3DataSet.Employee);
            }         
            catch 
            { 
                MessageBox.Show("you have an error"); 
            }  
        }
    }   
}
Posted
Comments
Afzaal Ahmad Zeeshan 15-Jun-15 17:24pm    
... And the problem is?
Mohammed-cd7 15-Jun-15 17:36pm    
i need all the steps to create the .exe file in visual studio 2012 of the application + the database(sqlite3)
Mohammed-cd7 16-Jun-15 8:38am    
any answer please

1 solution

InstallShield LE is very simple tool providing the basic features of setup deployment. You should add the database file myfirstdatabase.db3 to your InstallShield LE project, it will be placed where executable resides. Now you can use relative path in your code to access the db file which will be residing in the executable directory, however I did this by saving the absolute path to a text file (system.txt) and then the path is always achieved from that text file, if user wants to change the location of db file he will just replace the path with the existing path saved in system.txt
 
Share this answer
 
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900