新的Access数据库,怎么能做到呢? [英] New Access database, how can it be done?
本文介绍了新的Access数据库,怎么能做到呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 C#
使用微软Office访问
储存项目。我可以读取并保存到数据库中。
现在我需要让用户使用新的数据库项目,但结构类似的工作之一,也是落实另存为
选项。
I have a project in C#
using Microsoft Office Access
for storage. I can read and save to the database.
Now I need to allow the user to use the new database project but structured like the working one, and also to implement Save As
option.
此外,我需要导出到文本文件/ CSV。
Besides I need to export to a text file/CSV.
任何意见或样品codeS将是有益的。
Any ideas or sample codes would be helpful.
推荐答案
要创建一个空数据库的一种方法是尝试以下
One way to create a blank DB is to try the following
using System;
using ADOX;
public class CreateDB
{
public static void Main( string [] args )
{
ADOX.CatalogClass cat = new ADOX.CatalogClass();
string create =
@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\BlankAccessDB\MyAccessDBCreatedFromCsharp.mdb;" +
"Jet OLEDB:Engine Type=5";
cat.Create(create);
cat = null;
}
}
这两种保存,另存为的是用SaveFileDialog提示用户指定文件名和保存位置文件一样容易。
Both Save and SaveAs is as easy as using SaveFileDialog to prompt the user to specify the filename and location to save the file.
这篇关于新的Access数据库,怎么能做到呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文