C# 数据库文件目录
我正在使用 Windows Forms 应用程序和 MS Access 数据库。我想知道是否有一种方法可以显示数据库文件的目录(在其中保存数据),除了这样:
string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=save.mdb ”;
OleDbConnection empConnection = new OleDbConnection(conString);
string insertStatement = "INSERT INTO zivila "
+ "([naziv],[kalorij],[beljakovin],[oh],[mascob]) "
+ "VALUES (@naziv,@kalorij,@beljakovin,@oh,@mascob)";
或这样:
- “数据源=D:\Simonova aktovka na namizju\matura\test5\save.mdb”;
因为如果我使用第一个应用程序,则应用程序会撤消我关闭它时所做的更改(应用程序) 第二个使我每次将应用程序带到另一台计算机时都必须更改路径(因为目录与 coars 不同) 那么……还有别的办法吗?
I'm using the windows forms aplication with an ms access database. And i would like to know if there is a way to show the directory of the database file (to save data in it)excpet like this:
string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=save.mdb";
OleDbConnection empConnection = new OleDbConnection(conString);
string insertStatement = "INSERT INTO zivila "
+ "([naziv],[kalorij],[beljakovin],[oh],[mascob]) "
+ "VALUES (@naziv,@kalorij,@beljakovin,@oh,@mascob)";
or this:
- "Data Source=D:\Simonova aktovka na namizju\matura\test5\save.mdb";
couse if i use the first one the aplication undos the changes i've made when i close it(the aplication)
the second one makes me have to change the path everytime i bring the aplication to another computer(cous the direktory is different of coars)
So... is there another way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个:
Try this: