VC++µÄADOÁ¬½ÓSQL Server²½Öè
1£ºSQL ServerÊý¾Ý¿âÅäÖÃ
¿ªÆô·þÎñÆ÷
ÍÐÅÌÏÔʾ·þÎñÆ÷Æô¶¯
2:ÔÚStaAfx.h ÖÐÌí¼ÓÈçÏ´úÂë
#import "C:\\Program Files\\Common Files\\System\\ado\\msado15.dll" no_namespace rename("EOF","adoEOF")rename("BOF","adoBOF")
//³öÏÖmsado15.dll ±íʾµ¼Èë³É¹¦
3:ÔÚBOOL CXXXApp::InitInstance()Öгõʼ»¯COM»·¾³
BOOL CXXXApp::InitInstance()
{
AfxEnableControlContainer();
::CoInitialize(NULL);
…….
ÊÍ·ÅCOM»·¾³
::CoUninitialize();
return FALSE;
}
4£ºËµÃ÷
ÀûÓÃϵͳĬÈ϶¨ÒåÈ«¾ÖCXXXAppÀàµÄ¶ÔÏótheApp¿ÉÒÔµ÷ÓÃÀà·½·¨£¨º¯Êý£©µÄÄÜÁ¦£¬
¹ÊÔÚCXXXAppÀàÖмÓÈëÁ¬½ÓÊý¾Ý¿âµÄ¹«¹²·½·¨—InitADOConn£¨£©ºÍ¹«¹²Êý¾Ý—
_ConnectionPtr m_pConnection¡£
5£ºInitADOConn£¨£©µÄÄÚ²¿ÊµÏÖ
void CXXXApp::InitADOConn()
{
//ÓÃÓÚÈ«¾Ö±äÁ¿µ÷ÓÃÁ¬½ÓÊý¾Ý¿â
HRESULT hr; //·µ»Ø¼´½á¹û±äÁ¿
try
{
hr=m_pConnection.CreateInstance("ADODB.Connection"); //³õʼ»¯Á¬½Ó×Ö·û¼¯
if(SUCCEEDED(hr))
{
&nbs
Ïà¹ØÎĵµ£º
/*
* File: main.cpp
* Author: Vicky
*
* Created on 2010Äê5ÔÂ8ÈÕ, ÏÂÎç2:47
*/
#include <iostream>
using namespace std;
void swap(int x, int y) {
cout << "x and y swap before : " << x << "\t" << y << endl;
int i = x;
x = y;
y = i; ......
/*
* File: main.cpp
* Author: Vicky
*
* Created on 2010Äê5ÔÂ8ÈÕ, ÏÂÎç2:47
*/
#include <iostream>
using namespace std;
class A{
public:
A(){
cout << "Ö´Ðй¹Ô캯Êý´´½¨Ò»¸ö¶ÔÏó" << endl;
}
A(A&){
cout << "Ö´Ðп½±´º¯Êý¿½±´Ò»¸ö¶ ......
ÔÚSQLÓïÑÔÖУ¬Ö»ÌṩÁËÒ»¸ö¶¯´ÊSELECTÓÃÀ´½øÐÐÊý¾Ý²éѯ²Ù×÷£¬µ«Õâ¸ö¶¯´ÊµÄ²ÎÊýÊ®·Ö¸´ÔÓ£¬ÇÒÄÜǶÌ×ʹÓã¬ÆäͨÓøñʽÈçÏ£º
SELECT [All|Distinct]<Ä¿±êÁбí´ïʽ>[£¬<Ä¿±êÁбí´ïʽ>]...
from <±íÃû»òÊÓͼÃû>[£¬<±íÃû»òÊÓͼÃû>]...
[WHERE<Ìõ¼þ±í´ïʽ>]
[GROUP BY<ÁÐÃû1>[HAVING<Ì ......
Ò»¡¢SQL´æ´¢¹ý³ÌµÄ¸ÅÄÓŵ㼰Óï·¨
¡¡¡¡ÕûÀíÔÚѧϰ³ÌÐò¹ý³Ì֮ǰ£¬ÏÈÁ˽âÏÂʲôÊÇ´æ´¢¹ý³Ì?ΪʲôҪÓô洢¹ý³Ì£¬ËûÓÐÄÇЩÓŵã
¡¡¡¡¶¨Ò壺½«³£ÓõĻòºÜ¸´ÔӵŤ×÷£¬Ô¤ÏÈÓÃSQLÓï¾äдºÃ²¢ÓÃÒ»¸öÖ¸¶¨µÄÃû³Æ´æ´¢ÆðÀ´, ÄÇôÒÔºóÒª½ÐÊý¾Ý¿âÌṩÓëÒѶ¨ÒåºÃµÄ´æ´¢¹ý³ÌµÄ¹¦ÄÜÏàͬµÄ·þÎñʱ,Ö»Ðèµ÷ÓÃexecute,¼´¿É×Ô¶¯Íê³ ......
[Sql]EXCEPT ºÍ INTERSECT¹Ø¼ü×Ö
http://www.cnblogs.com/treeyh/archive/2008/07/01/1232845.html
EXCEPT
´Ó EXCEPT ²Ù×÷Êý×ó±ßµÄ²éѯÖзµ»ØÓұߵIJéѯδ·µ»ØµÄËùÓзÇÖظ´Öµ¡£
INTERSECT
·µ»Ø INTERSECT ²Ù×÷Êý×óÓÒÁ½±ßµÄÁ½¸ö²éѯ¾ù·µ»ØµÄËùÓзÇÖظ´Öµ¡£
A. ʹÓà EXCEPT
ÔÚʾÀýÖÐʹÓà TableA ºÍ TableB ÖеÄÊý¾Ý¡£
......