Я создал таблицу в своей базе данных с ADOX. Я хочу заполнить мои столбцы списком. Как я могу это сделать? Один список - это строка, которая должна заполнять столбец «ScheduleName», а один список - это целочисленный список, который должен заполнять столбец «SchedulePace». Вот как я создаю мой стол:Заполнение столбца, созданного ADOX со списком C#
public partial class ScheduleStart : Form
{
const string _ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=F:\A2 Computing\C# Programming Project\TriHard.accdb";
private Catalog OpenDatabase()
{
Catalog catalog = new Catalog();
Connection connection = new Connection();
try
{
connection.Open(_ConnectionString);
catalog.ActiveConnection = connection;
}
catch (Exception)
{
catalog.Create(_ConnectionString);
}
return catalog;
}
private void button1_Click(object sender, EventArgs e)
{
// Only for demonstration purposes, no error checks:
// This code will only work as long as the table "Publisher" does not exist
// First create an new database if necessary
Catalog cat = OpenDatabase();
// Create a new table "Publisher" using ADOX
Table table = new Table();
table.Name = "ScheduleEvent";
cat.Tables.Append(table);
// Add Column "ScheduleID" with Autoincrement
ADOX.Column col = new Column();
col.Name = "ScheduleID";
col.ParentCatalog = cat;
col.Type = ADOX.DataTypeEnum.adInteger;
col.Properties["Nullable"].Value = false;
col.Properties["AutoIncrement"].Value = true;
table.Columns.Append(col);
// Add column "ScheduleName"
col = new Column();
col.Name = "ScheduleName";
col.ParentCatalog = cat;
col.Type = ADOX.DataTypeEnum.adWChar;
col.DefinedSize = 50;
col.Attributes = ColumnAttributesEnum.adColNullable;
table.Columns.Append(col);
// Add column "SchedulePace"
col = new Column();
col.Name = "SchedulePace";
col.ParentCatalog = cat;
col.Type = ADOX.DataTypeEnum.adInteger;
col.DefinedSize = 50;
col.Attributes = ColumnAttributesEnum.adColNullable;
table.Columns.Append(col);
// Make "PublisherID" the primary key
ADOX.Index index = new ADOX.Index();
index.PrimaryKey = true;
index.Name = "PK_ScheduleEvent";
index.Columns.Append("ScheduleID", table.Columns["ScheduleID"].Type, table.Columns["ScheduleID"].DefinedSize);
table.Indexes.Append(index);
MessageBox.Show("The Schedule table has been created");
}
public ScheduleStart()
{
InitializeComponent();
}
Так что это создает таблицу и первичные ключ самих приращений при добавлении новых значений. Я хочу заполнить два других поля списками, которые я создал. Как я могу это сделать?