zoukankan      html  css  js  c++  java
  • C++ ADO连接

    #include "stdafx.h"
    #include <iostream>
    #include <iomanip>
    #include "windows.h"
    using namespace std;
    #import "C:Program FilesCommon FilesSystemadomsado15.dll" no_namespace rename("EOF","EndOfFile")
    int _tmain(int argc, _TCHAR* argv[])
    {
    	::CoInitialize(NULL);
    	_RecordsetPtr recordP("ADODB.RecordSet");
    	_ConnectionPtr connp("ADODB.Connection");
    	try{
    		connp.CreateInstance("ADODB.Connection");
    		_bstr_t strSQL="Provider=SQLOLEDB;Server=WIN-4MOED8K4727,1433;DataBase=proTest;UID=cjr;PWD=123";
    		connp->Open(strSQL,"","",adModeUnknown);
    		cout<<"connection success"<<endl;
    		if(connp==NULL){
    			cout<<"error"<<endl;
    		}
    	}catch(_com_error e){
    		cout<<e.Description()<<endl;
    	}
    	return 0;
    }
    

          

  • 相关阅读:
    外观模式
    适配器模式
    桥接模式
    中文词频统计
    英文词频统计
    字符串练习
    Python基础
    熟悉常用的Linux操作
    作业
    递归下降分析法
  • 原文地址:https://www.cnblogs.com/java-cjt/p/4279227.html
Copyright © 2011-2022 走看看