How to create an Access database by using ADOX and Visual C# .NET
Posted
by
SAMIR BHOGAYTA
on Samir ASP.NET with C# Technology
See other posts from Samir ASP.NET with C# Technology
or by SAMIR BHOGAYTA
Published on 2010-01-28T03:36:00.000-08:00
Indexed on
2010/12/06
17:00 UTC
Read the original article
Hit count: 375
How to create an Access d
1. Open a new Visual C# .NET console application.
2. In Solution Explorer, right-click the References node and select Add Reference.
3. On the COM tab, select Microsoft ADO Ext. 2.7 for DDL and Security, click Select to add it to the Selected Components, and then click OK.
4. Delete all of the code from the code window for Class1.cs.
5. Paste the following code into the code window:
using System;
using ADOX;
private void btnCreate_Click(object sender, EventArgs e)
{
ADOX.CatalogClass cat = new ADOX.CatalogClass();
cat.Create("Provider=Microsoft.Jet.OLEDB.4.0;" +"Data Source=D:\\NewMDB.mdb;" +"Jet OLEDB:Engine Type=5");
MessageBox.Show("Database Created Successfully");
cat = null;
}
© Samir ASP.NET with C# Technology or respective owner