Click here to Skip to main content
15,886,362 members
Articles / Database Development / SQL Server

.NET Installer that automatically installs MSDE

Rate me:
Please Sign up or sign in to vote.
3.63/5 (7 votes)
26 Jul 2008GPL36 min read 45.4K   557   30  
This project enables developers to create a setup package that automatically installs MSDE and attaches database
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using JohnKenedy.DataAccess;
using JohnKenedy.Samples;

namespace MenuMakanan
{
    public partial class Login : Form
    {
        public Login()
        {
            InitializeComponent();
            
            DataAccessLayer _dal = new DataAccessLayer(SqlServerType.MSSQL, System.Configuration.ConfigurationManager.ConnectionStrings["connection"].ConnectionString);
            DataAccessLayer.Manager = _dal.GetDataAccessTableManager();
            DataAccessLayer.Manager.DALLayer = _dal;
            DataAccessLayer.Audit = _dal.GetAudit();

            Installation _ins = new Installation("Food", "JOHN", "MenuMakanan", "Food", "JOHNKENEDYDAL", "FOOD_Data.MDF");
            if (_ins.IsDone == false) _ins.ShowDialog();
            if (_ins.IsRestart == true)
            {
                Application.Exit();
                this.Close();
                return;
            }

            this.Hide();
            MainMenu _menu = new MainMenu();
            _menu.ShowDialog();
            this.Close();
        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            DataAccessLayer.Manager.DALLayer.OpenConnectionTryClose();

            MUserEntity _item = new MUserEntity();

            if (_item.IsLoginMUserValid(txtUsername.Text, txtPassword.Text) == false)
            {
                MessageBox.Show("Username or Password is invalid");
                DataAccessLayer.Manager.DALLayer.CloseConnection();
                return;
            }
            DataAccessLayer.Manager.DALLayer.CloseConnection();

            this.Hide();
            MainMenu _menu = new MainMenu();
            _menu.ShowDialog();
            this.Close();
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Software Developer (Senior)
Singapore Singapore
I write code mostly in C#, VB.NET, PHP and Assembly.

Comments and Discussions