以编程方式创建mdb [英] programmatically create mdb

查看:82
本文介绍了以编程方式创建mdb的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!

我有一个需要mdb文件才能运行的应用程序.

如果删除数据,则mdb文件的大小不会减小.
我知道有一些方法可以压缩mdb文件,但是我想创建一个新的
mdb文件,还可以创建具有单个colunm且没有索引的单个表.

谁能告诉我该怎么做?

Hi!

I have an app which requires mdb files to function.

If I delete data, the size of the mdb file doesn''t go down.
I know there are ways to compact mdb files, but I want to create a new
mdb file and also to create a single table with a single colunm and with no index.

Can anyone tell me how to do that?

推荐答案

http://www.freevbcode.com/ShowCode.asp?ID=5797 [ ^ ]

http://msmvps.com/blogs/gaidar/archive/2005/09/13/66282.aspx [ ^ ]
http://www.freevbcode.com/ShowCode.asp?ID=5797[^]

http://msmvps.com/blogs/gaidar/archive/2005/09/13/66282.aspx[^]


我最近(老实说,昨天)所做的是:

1.使用Access创建一个空的MDB文件("empty.mdb").

2.将空的MDB文件作为资源添加到我的可执行文件中.这使得文件可以作为byte[]数组进行访问.

3.每当我需要一个空的MDB文件时,我都会简单地访问字节数组,并将其作为MDB文件写入磁盘上所需的目标路径.

4.然后,我可以通过在新的MDB数据库上执行SQL脚本来创建所需的表.
What I did recently (yesterday to be honest) was:

1. Create an empty MDB file with Access ("empty.mdb").

2. Add the empty MDB file as a resource to my executable. This makes the file accessable as a byte[] array.

3. Whenever I need an empty MDB file, I simple access the byte array and write it as an MDB file to the required destination path on my disk.

4. Then, I can create the tables I want by executing SQL scripts on the new MDB database.


谢谢您的答复!

我试了一下,它像微风一样工作. :)
唯一的想法是,我需要提供一个单独的dll.
那对老板来说是完全不可以的! :(

不是一种便携式的方法吗?

我听说您可以将exe和dll结合使用.
是真的吗?
怎么样?
hey thanks for the reply!

I tried it and it works like a breeze. :)
The only think is that I''ll need to provide a separate dll.
Thats a complete no-no for the boss! :(

isn''t a portable way to do that?

I have heard that you can combine exe and dlls.
is that true?
how?


这篇关于以编程方式创建mdb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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