1
Fork 0

Moved initialization to different file.

This commit is contained in:
Jake Howard 2014-07-25 19:07:08 +01:00
parent af4e7fdf87
commit 74f6359f77
2 changed files with 34 additions and 0 deletions

View file

@ -55,6 +55,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="setup.cs" />
<Compile Include="databaseTools.cs" />
<Compile Include="ejectDrive.cs" />
<Compile Include="splashScreen.cs">

View file

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Data.SqlServerCe;
namespace Saviour_Backup_System
{
class setup
{
public static void initProgram()
{
string databaseName = databaseTools.databaseName;
if (File.Exists(databaseName)) { return; } // If the program has been run before, then the database will exist, so use that to test it.
SqlCeEngine SQLEngine = new SqlCeEngine("Data Source = " + databaseName);
SQLEngine.CreateDatabase(); //Creates the database if it doesnt exist already
SqlCeConnection conn = new SqlCeConnection("Data Source = " + databaseName);
conn.Open();
SqlCeCommand cmd = conn.CreateCommand();
cmd.CommandText = "CREATE TABLE Rules (%%);"; //Fill these in! (Before running)
cmd.ExecuteNonQuery();
cmd.CommandText = "CREATE TABLE Properties (%%);"; //Fill this one in too
cmd.ExecuteNonQuery();
cmd.CommandText = "CREATE TABLE ";
}
}
}