VC连接SQL数据库

来源:百度知道 编辑:UC知道 时间:2024/05/27 08:06:06
代码如下:
m_pConn->Open("Provider=SQLOLEDB.1; Driver={SQLServer};Server=LENOV07260662;Database=学生管理数据库;UserID=sa;Password='';");

编译时出现错误如下:
-------------------Configuration: student - Win32 Debug--------------------
Compiling...
student.cpp

F:\c++练习\studentsystem\student.cpp(36) : error C2660: 'Open' : function does not take 1 parameters
Error executing cl.exe.

student.exe - 1 error(s), 0 warning(s)

请教这是怎么回事?恳请代码写的详细些!谢谢
还是不行!
-------------------Configuration: student - Win32 Debug--------------------
Compiling...
student.cpp
f:\c++练习\studentsystem\debug\msado15.tlh(407) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
F:\c++练习\studentsystem\student.cpp(36) : error C2143: syntax error : missing ')' before ';'
F:\c++练习\studentsystem\student.cpp(36) : error

m_pConnection->Open("driver={SQL Server};Server=LENOV07260662;Database=学生管理数据库;UserID=sa;Password=";",
"",
"",
adConnectUnspecified);/// 连接数据库
你的参数个数不对 后面还有三个参数
换成我的代码再试试
我想是你抄写有问题!!!请问你仔细看过错误的意思了没有?
error C2143: syntax error : missing ')' before ';' //意思缺少分号