if (db == null)
{
db = new SQLiteConnection(_dbName);
db.Open();
}
}
private void Close()
{
if (db != null)
{
db.Dispose();
db = null;
}
}
//Insert operation
public int Insert(T obj, string statement) where T : new()
{
try
{
Open();
SQLiteCommand cmd = db.CreateCommand(statement);
int rec = cmd.ExecuteNonQuery(obj);
return rec;
}
catch (SQLiteException ex)
{
System.Diagnostics.Debug.WriteLine("Insert failed: " + ex.Message);
throw ex;
}
}
// Delete operation
public void Delete(string statement) where T : new()
{
try
{
{
db = new SQLiteConnection(_dbName);
db.Open();
}
}
private void Close()
{
if (db != null)
{
db.Dispose();
db = null;
}
}
//Insert operation
public int Insert(T obj, string statement) where T : new()
{
try
{
Open();
SQLiteCommand cmd = db.CreateCommand(statement);
int rec = cmd.ExecuteNonQuery(obj);
return rec;
}
catch (SQLiteException ex)
{
System.Diagnostics.Debug.WriteLine("Insert failed: " + ex.Message);
throw ex;
}
}
// Delete operation
public void Delete(string statement) where T : new()
{
try
{