
the internet in my apt.
Various thoughts and projects that grab my attention for more than a few minutes.
public void Reset()
{
if (string.IsNullOrEmpty(ConnectionString) && Connection == null)
throw new Exception("Connection string and connection are null.");
else
{
if (Connection == null)
Connection = new MySqlConnection(ConnectionString);
Connection.Open();
MySqlCommand cmd = new MySqlCommand();
cmd.CommandText = "DROP DATABASE SystemsLogica; CREATE DATABASE SystemsLogica; USE SystemsLogica;";
cmd.CommandType = System.Data.CommandType.Text;
cmd.Connection = Connection;
cmd.ExecuteNonQuery();
Assembly asm = Assembly.GetExecutingAssembly();
string[] scripts = asm.GetManifestResourceNames();
Array.Sort(scripts);
foreach (string file in scripts)
{
Stream res = asm.GetManifestResourceStream(file);
byte[] resbytes = new byte[res.Length];
res.Read(resbytes, 0, (int)res.Length);
Console.WriteLine(file);
Console.WriteLine("-----------------");
Console.WriteLine(Encoding.ASCII.GetString(resbytes));
Console.Write("\n\n\n");
using (cmd = new MySqlCommand())
{
cmd.CommandText = Encoding.ASCII.GetString(resbytes);
cmd.CommandType = System.Data.CommandType.Text;
cmd.Connection = Connection;
cmd.ExecuteNonQuery();
}
}
Connection.Close();
}
}