Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I am using MS Access Database to write & read some data but i am not deleting any of these data's since data is continuously taken for analysis. So Can anybody tell me how to create another MS ACCESS Database programmatically once the earlier database becomes full. I read that the capacity of MS Access database is 2GB, so if it exceeds the given limit i might not be in a position to add data. So with reference to size of the database, i want to create another database in the same location with a different name & also should be in a position to give a different name & perform other tasks like read & write programmatically.

Thanks in advance.
Posted
Updated 22-Jul-13 20:31pm
v3

1 solution

Hi,
You can try this out

1)Add reference from : C:\Program Files (x86)\Microsoft.NET\Primary Interop Assemblies\adodb.dll
2)Add reference: Microsoft ADO Ext. 2.8 for DDL and Securityence for
using ADOX;


bool result = false;
ADOX.Catalog cat = new ADOX.Catalog();
ADOX.Table table = new ADOX.Table();

//Create the table and it's fields.
table.Name = "Table1";
table.Columns.Append("Field1");
table.Columns.Append("Field2");

try
{
cat.Create("Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + database + "; Jet OLEDB:Engine Type=5");
cat.Tables.Append(table);

//Now Close the database
ADODB.Connection con = cat.ActiveConnection as ADODB.Connection;
if (con != null)
con.Close();

result = true;
}
catch (Exception ex)
{
result = false;
}
cat = null;
return result;
 
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