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
Ïà¹ØÎĵµ£º
SQL ³£ÓÃÓï¾äÒÔ¼°º¯ÊýÖ®Ò»
SELECT --´ÓÊý¾Ý¿â±íÖмìË÷Êý¾ÝÐкÍÁÐ
¡¡¡¡¡¡¡¡¡¡¡¡INSERT --ÏòÊý¾Ý¿â±íÌí¼ÓÐÂÊý¾ÝÐÐ
¡¡¡¡¡¡¡¡¡¡¡¡DELETE --´ÓÊý¾Ý¿â±íÖÐɾ³ýÊý¾ÝÐÐ
¡¡¡¡¡¡¡¡¡¡¡¡UPDATE --¸üÐÂÊý¾Ý¿â±íÖеÄÊý¾Ý
¡¡¡¡--Êý¾Ý¶¨Òå
¡¡¡¡ CREATE TABLE --´´½¨Ò»¸öÊý¾Ý¿â±í
¡¡¡¡¡¡¡¡¡¡¡¡DROP TABLE --´ÓÊý¾Ý¿âÖÐɾ³ý±í
......
´´½¨º¯Êý
CREATE OR REPLACE FUNCTION ntfuc(inp IN NUMBER)
RETURN NUMBER
IS
ntmp NUMBER;
BEGIN
ntmp := inp;
RETURN ntmp;
END ntfuc;
/
Ö´Ðиú¯Êýʱ
DECLARE
rcn NUMBER;
BEGIN
rcn := ntfunc(1);
END;
/ ......
/*
* 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 << "Ö´Ðп½±´º¯Êý¿½±´Ò»¸ö¶ ......
ÎÒÓõÄLinuxϵͳÊÇUbuntu 10.04
Ê×ÏÈ, °²×°wxWidgets 2.8. Ä¿Ç°wxWidgetsÓÐÁ½¸öÎȶ¨°æ±¾, 2.6ºÍ2.8, ÎÒÃÇÑ¡×îеÄ. ´ò¿ª “Ubuntu
Èí¼þÖÐÐÄ”, ÔÚËÑË÷¿òÀïÊäÈë “wxWidgets”, °ÑÏÂÃ漸¸öÃû×ÖÒÔ”wxWidgets Cross-platform C++ GUI
toolkit”¿ªÍ·µÄÈ«²¿°²×°. ×°Íêºó, ´ò¿ªÒ»¸öÖÕ¶Ë, ÊäÈ ......
ÔÚSQLÓïÑÔÖУ¬Ö»ÌṩÁËÒ»¸ö¶¯´ÊSELECTÓÃÀ´½øÐÐÊý¾Ý²éѯ²Ù×÷£¬µ«Õâ¸ö¶¯´ÊµÄ²ÎÊýÊ®·Ö¸´ÔÓ£¬ÇÒÄÜǶÌ×ʹÓã¬ÆäͨÓøñʽÈçÏ£º
SELECT [All|Distinct]<Ä¿±êÁбí´ïʽ>[£¬<Ä¿±êÁбí´ïʽ>]...
from <±íÃû»òÊÓͼÃû>[£¬<±íÃû»òÊÓͼÃû>]...
[WHERE<Ìõ¼þ±í´ïʽ>]
[GROUP BY<ÁÐÃû1>[HAVING<Ì ......