Home > Database > Mysql Tutorial > vc++连结数据库

vc++连结数据库

WBOY
Release: 2016-06-07 15:17:21
Original
1167 people have browsed it

1,连结Access数据库 m_pConn-open(provider=Microsoft.Jet.OLEDB.4.0;Data Sourse=DataBaseName;,,adConnectionUnspecified); 2,连结SQL数据库 m_pConn-open(driver=SQLOLEDB;server=127.0.0.1;DataBase=databasename;UID=,PWD=,,,adModeUnknown); 在连结SQ

1,连结Access数据库

m_pConn->open("provider=Microsoft.Jet.OLEDB.4.0;Data Sourse=DataBaseName;""","",adConnectionUnspecified);

2,连结SQL数据库

m_pConn->open("driver=SQLOLEDB;server="127.0.0.1";DataBase="databasename";UID="",PWD=""","","",adModeUnknown);

在连结SQL数据库时Error如下:

1,连结字符串属性无效

可能是字符串书写有误

2,数据库不存在或者访问被拒绝

数据库没有监控相应的端口,或者客户端连结端口与数据库不一致。2,可能是数据库设置错误。在配置管理器中,启动TCP/IP协议,同时重启SQL server.

3,未知错误

可能是DAtaBase访问PWD出错。2,用try和catch捕捉相应错误。

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