Home > Database > Mysql Tutorial > body text

VC++ Access数据库

WBOY
Release: 2016-06-07 15:43:29
Original
1520 people have browsed it

VC++打开Access数据库可以如下操作: _bstr_tstrconnect="Provider=Microsoft.ACE.OLEDB.12.0;DataSource=E:\\MYDB.accdb;PersistSecurityInfo=False"; m_myconnect-Open(strconnect,"","",adModeUnknown); 但是这种操作只能在程序里指定是访问E:\\MYDB.accd

VC++  打开Access 数据库 可以如下操作:
_bstr_t strconnect="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\\MYDB.accdb;Persist Security Info=False";  
m_myconnect->Open(strconnect,"","",adModeUnknown);

但是 这种操作 只能在程序里指定是访问E:\\MYDB.accdb这个数据库  如果要访问别的数据库 只能修改程序了

所以 我设置了一个“选择要打开的文件”按钮 点击之后 可以选择文件 
并且 使用filepath=fileDlg.GetPathName(); 获得文件名和文件路径
但是如果 让Data Source=filepath;  是打不开数据库的 因为在“”双引号中 filepath只能做字符串处理

急求解决办法  

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!