我们如何使用VB.NET创建mdb文件 [英] How WE can Create mdb file with VB.NET
本文介绍了我们如何使用VB.NET创建mdb文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
HI
我们如何使用VB.NET创建mdb文件?
tanx
HI
How WE can Create mdb file with VB.NET?
tanx
推荐答案
阅读这些内容:
http://www.vbforums.com/archive/index.php/t-251384.html [^ ]
http://bytes.com/topic/visual-basic-net/answer/361851-create-mdb-vb-net [ ^ ]
http://stackoverflow.com/questions/2347628/创建和更新ms-access-mdb-files-with-visual-basic [
Read these :
http://www.vbforums.com/archive/index.php/t-251384.html[^]
http://bytes.com/topic/visual-basic-net/answers/361851-create-mdb-vb-net[^]
http://stackoverflow.com/questions/2347628/creating-and-updating-ms-access-mdb-files-with-visual-basic[^]
一种方法是在Interop.Access >另一种方式是使用 ADOX
library.
这是从这里提取的代码:
http://stackoverflow. com/questions/155848/how-do-i-create-a-microsoft-jet-access-database-without-an-interop-assembly [
One way is usingInterop.Access
in.NET framework
and another way is usingADOX
library .
Here is the code which is extracted from here :
http://stackoverflow.com/questions/155848/how-do-i-create-a-microsoft-jet-access-database-without-an-interop-assembly[^]
if (!File.Exists(DB_FILENAME))
{
var cnnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + DB_FILENAME;
// Use a late bound COM object to create a new catalog. This is so we avoid an interop assembly.
var catType = Type.GetTypeFromProgID("ADOX.Catalog");
object o = Activator.CreateInstance(catType);
catType.InvokeMember("Create", BindingFlags.InvokeMethod, null, o, new object[] {cnnStr});
OleDbConnection cnn = new OleDbConnection(cnnStr);
cnn.Open();
var cmd = cnn.CreateCommand();
cmd.CommandText = "CREATE TABLE VideoPosition (filename TEXT , pos LONG)";
cmd.ExecuteNonQuery();
}
如果您不想使用ADOX,请阅读此文章以获取一些线索:
http://support.microsoft.com/kb/317114 [
and if you don''t want use ADOX read this article to get some clues :
http://support.microsoft.com/kb/317114[^]
But generally speaking generating MDB files in runtime is somehow an immature approach...
Good Luck
我以前见过这些.而且我无法使用它们.
如果您可能会介绍其他来源.或者:请编写代码.
我正在使用Microsoft Visual Studio2008.(WAP)
I had seen these before. And I could not use them.
If you may introduce other sources.or: Please write the code.
I am working with Microsoft Visual Studio 2008.(WAP)
这篇关于我们如何使用VB.NET创建mdb文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文