I am trying to check if a column exists and if not, add it. I've tried a couple of solutions including this, but the syntax isn't correct for Access db.
This is what I have so far:
public void Update(string task, string dbPath, string tableName = "Frames")
{
OleDbConnection db = new OleDbConnection("Provider=Microsoft.JET.OLEDB.4.0;data source=" + dbPath);
db.Open();
OleDbCommand command = db.CreateCommand();
command.CommandText = "COL_LENGTH('Frames','SetNumber')";
Debug.WriteLine(command.ExecuteReader());
/*
string[] restrictions = new string[] {null, null, tableName};
DataTable dtColumns = db.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, restrictions);
foreach (DataColumn column in dtColumns.Columns)
{
Debug.WriteLine(column.ColumnName);
}*/
}
I also tried using GetOleDbSchemaTable but it isn't returning the right table or something. What am I missing?