1: Solution Explorer --> reference --> (right-click) Add reference --> com --> Microsoft ADO Ext. 2.8 for DDL and security
2. Create a database
String dbname = @ "D: \ newaccess. mdb ";
ADOX. catalogclass access = new ADOX. catalogclass ();
Access. Create ("provider = Microsoft. Jet. oledb.4.0; Data Source =" + dbname + ";");
3: Create a table
// Create a table
ADOX. tableclass TBL = new ADOX. tableclass ();
TBL. parentcatalog = cat;
TBL. Name = "userinfo ";
// Add an Automatically increasing field
ADOX. columnclass Col = new ADOX. columnclass ();
Col. parentcatalog = cat;
Col. type = ADOX. datatypeenum. adinteger; // you must set the field type first.
Col. Name = "uid ";
Col. properties ["jet oledb: Allow zero length"]. value = false;
Col. properties ["autoincrement"]. value = true;
TBL. Columns. append (COL, ADOX. datatypeenum. adinteger, 0 );
// Add a text field
ADOX. columnclass col2 = new ADOX. columnclass ();
Col2.parentcatalog = cat;
Col2.name = "Description ";
Col2.properties ["jet oledb: Allow zero length"]. value = false;
TBL. Columns. append (col2, ADOX. datatypeenum. advarchar, 25 );
Cat. Tables. append (TBL );
TBL = NULL;
Cat = NULL;