This commit is contained in:
2026-02-09 15:37:45 -06:00
parent e33a68ac51
commit 9635b84c3e
501 changed files with 106873 additions and 0 deletions

View File

@@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ScaBox30.Controller
{
internal class DbController
{
private string _path;
private OleDbConnection _connection;
private OleDbCommand _command;
private OleDbDataReader _reader;
public void SetWorkingDb(string path)
{
_path = path;
}
public void Open()
{
_connection = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;" + "Data Source=" + _path);
try
{
_connection.Open();
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
public void Close()
{
try
{
_connection.Close();
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
public OleDbDataReader Query(string query)
{
try
{
_command = new OleDbCommand(query, _connection);
_reader = _command.ExecuteReader();
}
catch (Exception e)
{
Console.WriteLine(e);
}
return _reader;
}
public void InsertQuery(String query)
{
try
{
_command = new OleDbCommand(query, _connection);
_command.ExecuteNonQuery();
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
}
}