What I believe is the olderest, marked as 'AdvertsingProfitControl Alpha' by the folder. Only had a simple 'Add Records' form, quite incomplete.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Data.OleDb;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AdvertsingProfitControl
|
||||
{
|
||||
class AddRecord
|
||||
{
|
||||
private static string gConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=apcDatabase.accdb;Persist Security Info=False";
|
||||
|
||||
public AddRecord()
|
||||
{
|
||||
//Get database location from DBLocation class
|
||||
}
|
||||
|
||||
public int ExecuteQuery(string query)
|
||||
{
|
||||
int rowsAffected = -1;
|
||||
using (OleDbConnection conn = new OleDbConnection(gConnectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
OleDbCommand queryCommand = new OleDbCommand(query, conn);
|
||||
conn.Open();
|
||||
rowsAffected = queryCommand.ExecuteNonQuery();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show(e.Message, "Error Writing to Database");
|
||||
}
|
||||
}
|
||||
|
||||
return rowsAffected;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user