#pragma once
#include <Windows.h>

/************************************************************************/
/* This class connects to the access database and allows for simpler communication to the database   */
/************************************************************************/

using namespace System;
using namespace System::Data;
using namespace System::Data::OleDb;

ref class dbClass
{
public:
	// Constructor
	dbClass();
	// Issues a non-selecting query to the database
	void query(String ^strSQL );
	// Selects from the database
	void select( String ^strSQL );
	// Escapes the given string for database use
	String ^escape( String ^q );
	// Opens a connection to the db
	void openConnection();
	// Closes a connection to the db
	void closeConnection();
	// Returns a pointer to the reader object.
	OleDbDataReader ^getReader() { return reader; }
private:
	String ^connString;
	OleDbConnection ^cn;
	OleDbParameter ^pm;
	OleDbDataReader ^reader;
};