Add referenceMicrosoft ADO Ext. 2.8 for DDL and security","Microsoft ActiveX Data Objects 2.8 Library"
Static void main (string [] ARGs)
{
ADOX. Catalog cat = new ADOX. Catalog ();
Cat. Create ("provider = Microsoft. Jet. oledb.4.0;" + "Data Source = E: \ newmdb. mdb;" + "jet oledb: Engine type = 5 ");
ADODB. Connection conn = new ADODB. Connection ();
Conn. Open ("provider = Microsoft. Jet. oledb.4.0; Data Source = E: \ newmdb. mdb;", null, null,-1 );
Cat. activeconnection = conn;
ADOX. Table = new ADOX. Table (); // create a table
Table. Name = "firsttable ";
ADOX. Column Col = new ADOX. Column (); // create an Automatically increasing column
Col. parentcatalog = cat;
Col. Name = "ID ";
Col. type = ADOX. datatypeenum. adinteger;
Col. definedsize = 9;
Col. properties ["autoincrement"]. value = true; // set auto-Increment
Table. Columns. append (COL, ADOX. datatypeenum. adinteger, 9 );
Table. Keys. append ("firsttableprimarykey", keytypeenum. adkeyprimary, Col, null, null); // set the column as the primary key
Table. Columns. append ("customername", ADOX. datatypeenum. advarwchar, 50); // append a text column.
Table. Columns. append ("Age", ADOX. datatypeenum. adinteger, 9); // append an int type column.
Table. Columns. append ("Birthday", ADOX. datatypeenum. addate, 0); // append a column of the date type.
Cat. Tables. append (table); // append the table to the database.
Conn. Close ();
Console. writeline ("database created successfully .");
}