Tang Yong
May 15th, 1999, 12:52 AM
How to use the SQLOLE classes?
I created a new project using MFC AppWizard according the following steps.
1. Open Microsoft Visual C++ 6.0
2. Create a new project "SqlApp" using MFC AppWizard(Exe)
3. Open ClassWizard.
4. Click "AddClass" button,select "From a type library".
5. In the openfile dialog,select the file "sqlole65.tlb" from the directory where the SQLServer6.5 has been installed,click"Open".
6.In the confirm class dialog select all classes and click "Ok"Ħħ .
Thus, the project contains the classes "_SQLServer", "SQLServers" , "_Device" , "Devices" , "_Alert" , "Alerts" , "_Database" , "Databases" , and so on..
But the question is how I can use these classes.
For example , how can I connect to the SQLServer using the function
void _SQLServer::Connect(const VARIANT& ServerName, const VARIANT& Login, const VARIANT& Password)?
Assume I have writen the following codes:
_SQLServer sqlServer;
CoInitialize(NULL);
CString strServerName = "SqlServer",strLogin ="sa",strPassword = "";
sqlServer.Connect(strServerName,strLogin,strPassword);
After perform these codes,the connection is not be established.Why?
Who can help me?
Thanks a lot.
I created a new project using MFC AppWizard according the following steps.
1. Open Microsoft Visual C++ 6.0
2. Create a new project "SqlApp" using MFC AppWizard(Exe)
3. Open ClassWizard.
4. Click "AddClass" button,select "From a type library".
5. In the openfile dialog,select the file "sqlole65.tlb" from the directory where the SQLServer6.5 has been installed,click"Open".
6.In the confirm class dialog select all classes and click "Ok"Ħħ .
Thus, the project contains the classes "_SQLServer", "SQLServers" , "_Device" , "Devices" , "_Alert" , "Alerts" , "_Database" , "Databases" , and so on..
But the question is how I can use these classes.
For example , how can I connect to the SQLServer using the function
void _SQLServer::Connect(const VARIANT& ServerName, const VARIANT& Login, const VARIANT& Password)?
Assume I have writen the following codes:
_SQLServer sqlServer;
CoInitialize(NULL);
CString strServerName = "SqlServer",strLogin ="sa",strPassword = "";
sqlServer.Connect(strServerName,strLogin,strPassword);
After perform these codes,the connection is not be established.Why?
Who can help me?
Thanks a lot.