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

VC ³ÌÐòÖÐÈçºÎÓÃADOÁ¬½ÓSQL Server 2005?

Ê×ÏÈ˵Ã÷Ò»µã£ºVC³ÌÐòÖÐÓÃADOÁ¬½ÓSQL Server 2005 ºÍÁ¬½Ó SQL Server 2000µÄÓï¾äºÍÁ¬½Ó×Ö·û´®ÊÇÍêÈ«Ò»ÑùµÄ£¬ÏÂÃæµÄ´úÂëÊÊÓÃÓÚÁ½¸öÊý¾Ý¿âµÄÁ¬½Ó¡£
ÁíÒ»µã˵Ã÷£ºÈç¹ûÄãÒÔÇ°°²×°¹ýSQL Server 2000£¬ºóÔÚûÓÐжÔصÄÇé¿öÏÂÓÖ°²×°ÁË2005£¬ÄÇôÄã֮ǰÔÚ2000ÖÐÉèÖõÄÓû§ÃûºÍÃÜÂëÔÚ2005Öлᱣ³Ö£¬¼´Ê¹Äã°²×°2005ʱδÉèÖÃÈκÎÓû§ÃûºÍÃÜÂë¡£
ÏÂÃæÊÇVC³ÌÐòÖÐÓÃADOÁ¬½ÓSQL ServerÊý¾Ý¿âµÄÒ»¸öÀý×Ó£º
£¨1£©´´½¨Ò»¸ö»ùÓÚ¶Ô»°¿òµÄ¹¤³Ì£¬¹¤³ÌÃûΪTest¡£
£¨2£©ÔÚStdAfx.hÖе¼ÈëADO¶¯Ì¬Á´½Ó¿â£¬´úÂëÈçÏ£º
        #import "C:\Program Files\Common Files\System\ado\msado15.dll" no_namespace\
        rename("EOF","adoEOF")
£¨3£©ÔÚCTestApp::InitInstance()Öгõʼ»¯COM»·¾³£º
       ::CoInitialize(NULL);
       ×¢Ò⣬ÕâÌõÓï¾äÒ»¶¨Òª·ÅÔÚ“CTestDlg dlg;”ÕâÌõÓï¾äµÄÇ°Ã棬·ñÔòÔÚCTestDlgµÄº¯ÊýÖÐÁ¬½ÓÊý¾Ý¿â»áÒòÎÞ·¨´´½¨Á¬½ÓʵÀý¶øʧ    
       °Ü¡£
 £¨4£©ÔÚ¶Ô»°¿òµÄÍ·ÎļþÖÐÉùÃ÷ADOÖÇÄÜÖ¸Õë¡£
        _ConnectionPtr m_pConnection;  //Á¬½Ó¶ÔÏóÖ¸Õë
        _RecordsetPtr  m_pRecordset;     //¼Ç¼¼¯¶ÔÏóÖ¸Õë
 £¨5£©ÔÚCTestDlg::OnInitDialog()ÖÐÁ¬½ÓÊý¾Ý¿â£º
         try
        {
               m_pConnection.CreateInstance("ADODB.Connection");     //´´½¨Á¬½Ó¶ÔÏóʵÀý
              _bstr_t strConnect="Provider=SQLOLEDB.1;Persist Security Info=False;Initial Catalog=Query;
               Data  Source=127.0.0.1";           //Á¬½Ó×Ö·û´®£¬ÕâÀïQueryÊÇÊý¾Ý¿âÃû£¬127.0.0.1´ú±í±¾µØÖ÷»ú
 


Ïà¹ØÎĵµ£º

MySqlµÄ¼òµ¥Ð޸ıí×Ö¶ÎSQLÓï¾ä

#ÐÂÔöÒ»¸ö×ֶΣ¬Ä¬ÈÏֵΪ0£¬·Ç¿Õ£¬×Ô¶¯Ôö³¤£¬Ö÷¼ü
   alter table tabelname add new_field_name field_type default 0 not null auto_increment ,add primary key (new_field_name);
#Ôö¼ÓÒ»¸öÐÂ×Ö¶Î
   alter table tableName add new_field_name field_type;
   alter table tableNam ......

SQLËÙ²éÊÖ²á

Ò»¡¢»ù´¡
1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿â
CREATE DATABASE database-name
2¡¢ËµÃ÷£ºÉ¾³ýÊý¾Ý¿â
drop database dbname
3¡¢ËµÃ÷£º±¸·Ýsql server
--- ´´½¨ ±¸·ÝÊý¾ÝµÄ device
USE master
EXEC sp_addumpdevice 'disk', 'testBack', 'c:\mssql7backup\MyNwind_1.dat'
--- ¿ªÊ¼ ±¸·Ý
BACKUP DATABASE pubs TO testBac ......

Ò»¸öÏîÄ¿ÖÐÓõ½µÄ50¸öSQLÓï¾ä

ÕâÊÇCSDNÂÛ̳ÀïÃæµÄÒ»¸öÌû×Ó£¬×÷ÕßÊÇ°®Ð¾õÂÞ.ع»ª¡£¸Ð¾õ±È½ÏÈ«Ã棬¾ÍÕûÀíÏÂÀ´ÁË£¬Áô×÷ÒÔºó²Î¿¼±¸Óá£ÔÚ´Ë£¬Ôڴ˸Ðл±¾ÎĵÄ×÷Õß¡£
/*
±êÌ⣺һ¸öÏîÄ¿Éæ¼°µ½µÄ50¸öSqlÓï¾ä(ÕûÀí°æ)
×÷Õߣº°®Ð¾õÂÞ.ع»ª(Ê®°ËÄê·çÓ꣬ÊصñùɽѩÁ«»¨¿ª)
ʱ¼ä£º2010-05-10
µØµã£ºÖØÇ캽ÌìְҵѧԺ
˵Ã÷£ºÒÔÏÂÎåÊ®¸öÓï¾ä¶¼°´ÕÕ²âÊÔÊý¾Ý½øÐ ......

SQL SERVER 2005·ÖÒ³´æ´¢¹ý³Ì

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROCEDURE [dbo].[PE011_Page]
  @TableName varchar(50),        --±íÃû
 @Fields varchar(5000) = '*',    --×Ö¶ÎÃû(È«²¿×Ö¶ÎΪ*)
 @OrderField varchar(5000),    &n ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ