Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

C++ͨ¹ýADOÁ¬½ÓACCESS(»òÕßSQL Server)Êý¾Ý¿âÀý×Ó

#include "iostream.h"
#include "stdio.h"
#import "C:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF","adoEOF")
int main(int argc, char* argv[])
{
   ::CoInitialize(NULL);
_ConnectionPtr m_pConnection;
m_pConnection.CreateInstance("ADODB.Connection");
try               
    {
   m_pConnection->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Database\\mydb.mdb","","",adModeUnknown);
//m_pConnection->Open("Server=192.168.0.150,1433;uid=sa;pwd=123456;DATABASE=temp;Provider=SQLOLEDB;","","",-1);//Á¬½ÓSQL Server
}
catch(_com_error e)
{
        cout<<"Êý¾Ý¿âÁ¬½Óʧ°Ü£¬È·ÈÏÊý¾Ý¿âmydb.mdbÊÇ·ñÔÚµ±Ç°Â·¾¶ÏÂ!"<<endl;
   return FALSE;
    }
_RecordsetPtr m_pRecordset;
m_pRecordset.CreateInstance("ADODB.Recordset");
try
    {  
        m_pRecordset->Open("SELECT * from test",
   m_pConnection.GetInterfacePtr(),
   adOpenDynamic,
   adLockOptimistic,
   adCmdText);
}
catch(_com_error *e)
    {
        cout<<e->ErrorMessage()<<endl;
    }  
    _variant_t var;
    char *ID,*name;
    try
    {
        if(!m_pRecordset->BOF)
            m_pRecordset->MoveFirst();
        else {
            cout<<"±íÄÚÊý¾ÝΪ¿Õ"<<endl;
    return 1;
    }
   while(!m_pRecordset->adoEOF)
        {
    


Ïà¹ØÎĵµ£º

º½¿Õ¹«Ë¾¹ÜÀíϵͳ(VC++ ÓëSQL 2005)

ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
      ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃ棬ºóÃæ ......

PL/SQL³ÌÐòÉè¼Æ£¨ÓαêµÄʹÓÃ)

ΪÁË´¦Àí SQL Óï¾ä£¬ORACLE ±ØÐë·ÖÅäһƬ½ÐÉÏÏÂÎÄ( context area )µÄÇøÓòÀ´´¦ÀíËù±ØÐèµÄÐÅÏ¢£¬ÆäÖаüÀ¨Òª´¦ÀíµÄÐеÄÊýÄ¿£¬Ò»¸öÖ¸ÏòÓï¾ä±»·ÖÎöÒÔºóµÄ±íʾÐÎʽµÄÖ¸ÕëÒÔ¼°²éѯµÄ»î¶¯¼¯(active set)¡£
 ÓαêÊÇÒ»¸öÖ¸ÏòÉÏÏÂÎĵľä±ú( handle)»òÖ¸Õ롣ͨ¹ýÓα꣬PL/SQL¿ÉÒÔ¿ØÖÆÉÏÏÂÎÄÇøºÍ´¦ÀíÓï¾äʱÉÏÏÂÎÄÇø»á·¢ÉúЩʲôÊÂÇ ......

c/c++ÓïÑÔÎÊÌâÖпɱä²ÎÊý


 va_listÊÇc/c++ÓïÑÔÎÊÌâÖнâ¾ö¿É±ä²ÎÊýµÄÒ»×éºê.ÏÈÀ´¿´Ò»¸ö³ÌÐòÀý×Ó°É.
view plaincopy to clipboardprint?
#include <stdarg.h>   
/**¡¡º¯ÊýÃû£ºmax  
  *¡¡¹¦ÄÜ£º·µ»Øn¸öÕûÊýÖеÄ×î´óÖµ  
  *  ²ÎÊý£ºnum£ºÕûÊýµÄ¸öÊý . ......

sql ±íÁ¬½Ó

TA:
1,WANG
2,ZHANG
4,LI
TB:
1,100
2,200
3,400
1.left join ×óÁ¬½Ó--ÒÔ×ó±íΪ»ù×¼£¬ÓÒ±íÖÐûֵµÄ£¬ÔÚ½á¹û¼¯ÖÐÒÔnullÖµ´úÌæ¡£(select * from TA left join TB where TA.ID=TB.ID)
   1,WANG,100
   2,ZHANG,200
   4,NULL
2.right join ÓÒÁ¬½Ó--ÒÔÓÒ±íΪ»ù×¼£¬×ó±íÖÐûֵµÄ£¬ÔÚ ......

SQL XML DELETE

--A. ´Ó´æ´¢ÔÚ·ÇÀàÐÍ»¯µÄ xml ±äÁ¿ÖеÄÎĵµÖÐɾ³ý½Úµã
DECLARE @myDoc xml
SET @myDoc = '<?Instructions for=TheWC.exe ?>
<Root>
 <!-- instructions for the 1st work center -->
<Location LocationID="10" LaborHours="1.1" MachineHours=".2" >
 Some text 1
 <st ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ