Hello,
I am having to create a table
within a DB Access
at runtime.
The database already exists, I would just like that by clicking on a button
a new table
was created within this DB
with Field Name and Type of Data all pre-defined so that all new tables
are created with the same fields .
OleDbConnection ConSelect = new OleDbConnection();
ConSelect.ConnectionString = Properties.Settings.Default.dbteste;
ConSelect.Open();
OleDbCommand command = new OleDbCommand();
command.CommandText = "CREATE TABLE MyTable (" +
"[Count] INT NOT NULL AUTO_INCREMENT PRIMARY KEY ," +
"[TimeAndDate] TIMESTAMP NOT NULL ," +
"[SerialNumber] VARCHAR( 14 ) NOT NULL ," +
"[Result] BOOL NOT NULL ," +
"UNIQUE ([TimeAndDate]))";
command.ExecuteNonQuery();
ConSelect.Close();
This is a way I was trying, but still the error. - > Additional information: ExecuteNonQuery: Connection property has not been initialized.