如何将应用程序及其数据库移动到拇指驱动器? [英] How do I move an app and its database to a thumb drive?
问题描述
我有一个现有的SQL数据库,附带一个VB(2015)应用程序。目前这两个是在不同的驱动器上。我想将它们放在拇指驱动器上,以便我可以在任何计算机上访问它。
有2个明显的问题;
1如何将数据文件传输到拇指驱动器并让应用程序找到它?
2将拇指驱动器从一台计算机移动到另一台计算机时,驱动器名称将改变,我如何告诉应用程序处理这个?
我尝试过:
我试过上面这个,但当我把驱动器放在另一台计算机上时,我得到一个文件未找到错误。
使用确定数据库位置的应用程序路径请参见此处:
[ ^ ]
我假设你使用的是SQL Server,遗憾的是 SQL Server 是没有的很难以这种方式部署。
因此,如果可能的话,可以考虑以 XML格式存储数据,或者使用更合适的数据库,例如 SQLite 或 PostgreSQL (有便携版), PostgreSQL Portable下载| SourceForge.net [ ^ ]
这是一个小的VB.NET示例: PostgreSQL和VB.NET-VBForums [ ^ ]
I have an existing SQL database with an accompanying VB(2015) application. Presently the two are on different drives. I would like to put both on a thumb drive so I can access it on any computer.
There are 2 obvious problems;
1 How do I transfer the data file to the thumb drive and still have the application find it?
2 When moving the thumb drive from one computer to another the drive designation will change, how do I tell the application to handle this?
What I have tried:
I have tried to do the above, but when I put the drive in a different computer I get a file not found error.
Use the applications path to determine the location of the database see here:
[^]
I assume you are using SQL Server, unfortunately SQL Server is notoriously difficult to deploy in such a way.
So if possible think of alternatives like storing your data in XML format, or using a more suitable database like SQLite or PostgreSQL (which has a portable version), PostgreSQL Portable download | SourceForge.net[^]
Here is a small VB.NET example: PostgreSQL and VB.NET-VBForums[^]
这篇关于如何将应用程序及其数据库移动到拇指驱动器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!