当前手中开发的ADO程序在低版本的MDAC上无法正确运行,需要安装最新的MDAC,
问题是怎么通过程序判断当前系统的MDAC版本号?
问题是怎么通过程序判断当前系统的MDAC版本号?
解决方案 »
- 纯SDK写的WIN32程序,如何把参数变为一个CString?
- CreateFile的用法?
- 这段代码是什么意思??
- UINT GetDriveType(LPCTSTR lpRootPathName ),如何设置参数lpRootPathName,
- NetMeeting SDK开发中遇到的2个问题,在线等待!!!
- 关于CreateDispatch问题在线等待马上给分
- 问一个动态连接库的注册的问题:
- 代码中有很多设置窗口或控件大小的地方,都是直接用数字来描述的。想要好一点的风格,应如何处理这些呢?
- 问题:Depends的技术与实现
- 如何访问IE的数据?:(
- 串口编程?
- 这种情况下必须装Access2000吗
{
HRESULT hr = S_OK; // Define string variables.
_bstr_t strCnn("driver={SQL Server};server='MySqlServer';"
"user id='MyUserId';password='MyPassword';database='pubs';"); // Define ADO object pointers.
// Initialize pointers on define.
// These are in the ADODB:: namespace.
_ConnectionPtr pConnection = NULL; try
{
// Open connection.
TESTHR(pConnection.CreateInstance(__uuidof(Connection)));
pConnection->Open (strCnn, "", "", adConnectUnspecified); printf("ADO Version : %s\n\n",(LPCSTR) pConnection->Version);
printf("DBMS Name : %s\n\n",(LPCSTR) (_bstr_t)
pConnection->Properties->GetItem("DBMS Name")->Value);
printf("DBMS Version : %s\n\n",(LPCSTR) (_bstr_t)
pConnection->Properties->GetItem("DBMS Version")->Value);
printf("OLE DB Version : %s\n\n",(LPCSTR) (_bstr_t)
pConnection->Properties->GetItem("OLE DB Version")->Value);
printf("Provider Name : %s\n\n",(LPCSTR) (_bstr_t)
pConnection->Properties->GetItem("Provider Name")->Value);
printf("Provider Version : %s\n\n",(LPCSTR) (_bstr_t)
pConnection->Properties->GetItem("Provider Version")->Value);
printf("Driver Name : %s\n\n",(LPCSTR) (_bstr_t)
pConnection->Properties->GetItem("Driver Name")->Value);
printf("Driver Version : %s\n\n",(LPCSTR) (_bstr_t)
pConnection->Properties->GetItem("Driver Version")->Value);
printf("Driver ODBC Version : %s\n\n",(LPCSTR) (_bstr_t)
pConnection->Properties->GetItem("Driver ODBC Version")->Value); } catch (_com_error &e)
{
// Notify the user of errors if any.
PrintProviderError(pConnection);
PrintComError(e);
} if (pConnection)
if (pConnection->State == adStateOpen)
pConnection->Close();
}