Click here to Skip to main content
15,893,622 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to create a access database automatic in c# win application
Posted
Comments
OriginalGriff 14-Feb-12 15:10pm    
Sorry? That doesn't make a lot of sense.
Please, edit your question and try to explain what you want in more detail.

Use the "Improve question" widget to edit your question and provide better information.

using System;
using ADOX;

namespace CreateDB
{
public class CCreateDB
{
public static bool CreateDB(string pstrDB)
{
try
{
Catalog cat = new Catalog();
string strCreateDB = "";

strCreateDB += "Provider=Microsoft.Jet.OLEDB.4.0;";
strCreateDB += "Data Source=" + pstrDB + ";";
strCreateDB += "Jet OLEDB:Engine Type=5";
cat.Create(strCreateDB);
return true;
}
catch (Exception)
{
throw;
}
}
}
}

Then, to create the database, just run:

bool blnSuccess = CCreateDB.CreateDB(@"c:\test.mdb");
 
Share this answer
 
Comments
rimza 16-Feb-12 3:40am    
how to create table and relation in this Database
I'm not sure if it serves your purpose, but here's one solution. Create a blank Jet database[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900