使用ODBC从位于Program Files文件夹中的数据库中读取 [英] Reading from a database located in the Program Files folder using ODBC

查看:243
本文介绍了使用ODBC从位于Program Files文件夹中的数据库中读取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个应用程序将其数据库文件存储在Program Files目录的子文件夹中。这些文件重定向到Vista和Windows 7中的VirtualStore。我们使用Microsoft DataReports(VB6)表示数据库中的数据。到目前为止很好。


但是我们现在想使用Crystal Reports XI来表示数据库中的数据。我们的想法是不将这些数据从我们的程序传递到CR,而是让CR使用系统DSN通过ODBC从数据库中检索它。这样,我们希望向用户提供更大的灵活性,以设计他们自己的报告。我们想要确保的是,当用户安装程序或程序调用Crystal Report时,这些系统DSN是正确配置的。


有一个聪明的方法使用系统变量,而不必编写检查OS版本的例程,是否在操作系统上启用UAC,是否已解除对Program Files文件夹的写入限制等,然后使系统DSN适应于C: \Program Files\OurApp\Data文件夹或C:\Users\User\AppData\VirtualStore\Program Files\OurApp\Data文件夹?


对完全不同的方法也是受欢迎的!

We have an application that stores its database files in a subfolder of the Program Files directory. These files are redirected to the VirtualStore in Vista and Windows 7. We represent data from the database using Microsoft DataReports (VB6). So far so good.

But we now want to use Crystal Reports XI to represent data from the database. Our idea is to NOT pass this data to CR from our program, but to have CR retreive it from the database using a a system DSN through ODBC. In this way we hope to present our users with more flexibility in designing their own reports. What we do want to ensure though is that these system DSNs are configured correctly when the user installs our program or when the program calls the Crystal Report.

Is there a smart way to do this using System variables for instance, instead of having to write a routine that checks for OS-version, whether UAC is enabled on the OS, whether the write restrictions on the Program Files folder have been lifted, etc and then adapts he System DSN to point to either the C:\Program Files\OurApp\Data folder, or the C:\Users\User\AppData\VirtualStore\Program Files\OurApp\Data folder?

Suggestions for an entirely different approach are welcome too!

推荐答案

看起来虚拟商店处理一切,所以你可以指出DSN C:\Program Files\MyApp\Data\mydb.mdb,即使数据库已重定位到虚拟商店。

It seems that Virtual Store takes care of everything, so you can point the DSN blatantly at C:\Program Files\MyApp\Data\mydb.mdb even while the database has been relocated to the Virtual Store.

这篇关于使用ODBC从位于Program Files文件夹中的数据库中读取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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