创建另一个MS Access数据库 [英] Creating another MS Access Database

查看:59
本文介绍了创建另一个MS Access数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我正在使用MS Access数据库来写入和读取一些数据但我没有删除任何这些数据,因为数据不断被用于分析。因此,任何人都可以告诉我如何在早期数据库变满后以编程方式创建另一个MS ACCESS数据库。我读到MS Access数据库的容量是2GB,所以如果超过给定的限制,我可能无法添加数据。因此,参考数据库的大小,我想在同一位置创建另一个具有不同名称的数据库,并且还应该能够提供不同的名称并执行其他任务,例如以编程方式读取和写入。



提前致谢。

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.

推荐答案



你可以试试这个



1)添加引用自:C:\Program Files(x86)\ Mesrosoft.NET \ Primary Interop Assemblies\adodb.dll

2)添加引用:Microsoft ADO Ext。 2.8使用ADOX获得DDL和Securityence

;





bool result = false;

ADOX.Catalog cat = new ADOX.Catalog();

ADOX.Table table = new ADOX.Table();



//创建表及其字段。

table.Name =Table1;

table.Columns.Append(Field1);

table.Columns.Append( Field2);



尝试

{

cat.Create(Provider = Microsoft.Jet.OLEDB .4.0;+数据源=+数据库+; Jet OLEDB:引擎类型= 5);

cat.Tables.Append(表);



//现在关闭数据库

ADODB.Connection con = cat.ActiveConnection as ADODB.Connection;

if(con!= null)

con.Close();



result = true;

}

catch(Exception ex)

{

result = false;

}

cat = null;

返回结果;
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;


这篇关于创建另一个MS Access数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆