c# SQLÊý¾Ý¿âÔ¶³ÌÁ¬½Ó¼°ÅäÖ÷½·¨
Ò»£ºC# Á¬½ÓSQLÊý¾Ý¿â
Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;
Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;
Server=myServerAddress;Database=myDataBase;User ID=myUsername;Password=myPassword;Trusted_Connection=False;
Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;
Server=myServerName\theInstanceName;Database=myDataBase;Trusted_Connection=True;
Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;
1£ºIntegrated Security²ÎÊý
µ±ÉèÖÃIntegrated SecurityΪ True µÄʱºò£¬Á¬½ÓÓï¾äÇ°ÃæµÄ UserID, PW ÊDz»Æð×÷Óõģ¬¼´²ÉÓÃwindowsÉí·ÝÑé֤ģʽ¡£
Ö»ÓÐÉèÖÃΪ False »òÊ¡ÂÔ¸ÃÏîµÄʱºò£¬²Å°´ÕÕ UserID, PW À´Á¬½Ó¡£
Integrated Security »¹¿ÉÒÔÉèÖÃΪ£ºsspi £¬Ï൱ÓÚ True£¬½¨ÒéÓÃÕâ¸ö´úÌæ True¡£
Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;
Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=true;
Data Source=myServerAddress;Initial Catalog=myDataBase;;User ID=myUsername;Password=myPasswordIntegrated Security=false;
2£º²ÎÊýTrusted_Connection
Trusted_Connection=true£¬½«Ê¹Óõ±Ç°µÄ Windows ÕÊ»§Æ¾¾Ý½øÐÐÉí·ÝÑéÖ¤
Trusted_Connection=false;½«²»²ÉÓÃÐÅÈÎÁ¬½Ó·½Ê½(Ò²¼´²»²ÉÓÃWindowsÑéÖ¤·½Ê½)£¬¶ø¸ÄÓÉSQL Server 2000ÑéÖ¤·½Ê½
Server=myServerAddress;Database=myDataBase;User ID=myUsername;Password=myPassword;Trusted_Connection=false;
Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;
3£ºInitial CatalogÊÇÄãÒªÁ¬½ÓµÄÊý¾Ý¿âµÄÃû×Ö
4£ºWINCEÁ¬½Ó
Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;User ID=myDomain\myUsername;Password=myPassword;
¶þ£º¿ÉÒÔÀûÓÃSqlConnectionStringBuilder£¬ÕâÑù²»±ØÈ¥¼
Ïà¹ØÎĵµ£º
Ò»¡¢¼Ó¿ìsqlµÄÖ´ÐÐËÙ¶È
¡¡¡¡1.select Óï¾äÖÐʹÓÃsort,»òjoin
¡¡¡¡Èç¹ûÄãÓÐÅÅÐòºÍÁ¬½Ó²Ù×÷£¬Äã¿ÉÒÔÏÈselectÊý¾Ýµ½Ò»¸öÁÙʱ±íÖУ¬È»ºóÔÙ¶ÔÁÙʱ±í½øÐд¦Àí¡£ÒòΪÁÙʱ±íÊǽ¨Á¢ÔÚÄÚ´æÖУ¬ËùÒԱȽ¨Á¢ÔÚ´ÅÅÌÉϱí²Ù×÷Òª¿ìµÄ¶à¡£
¡¡¡¡È磺
SELECT time_records.*, case_name¡¡
from time_records, OUTER cases¡¡
WHERE time_re ......
µ÷Óà MS SQL ±êÁ¿Öµº¯Êý£¬Ó¦¸ÃÔÚº¯ÊýÇ°Ãæ¼ÓÉÏ "dbo."£¬·ñÔò»á±¨ “²»ÊÇ¿ÉÒÔʶ±ðµÄ ÄÚÖú¯ÊýÃû³Æ”´íÎó¡£ÀýÈç
DECLARE @WhichDB TINYINT;
SELECT @WhichDB = user_GetWhichDB(1);--¿´¿´ÊÇÄĸöÊý¾Ý¿âµÄ
=================================================
-- ......
DBMS_CHANGE_NOTIFICATION
¶ÔÏó£¨±í£©Êý¾Ý¸üÐÂ֪ͨ
DBMS_APPLICATION_INFO
ÉèÖÃ/¶ÁÈ¡SESSION APPLICATIONÐÅÏ¢£¬²Ù×÷V$SESSION_LONGOPS
DBMS_ALERT
¸æ¾¯
DBMS_DATAPUMP
Êý¾ÝǨÒÆ
DBMS_DB_VERSION
Êý¾Ý¿â°æ±¾¶¨Òå
DBMS_DDL
Compiles¡¢wrapped¡¢Reorganizes ¶ÔÏó
DBMS_DEBUG
ORACLE DEPL/SQL debugger ¹¤¾ß
DB ......
CREATE procedure SqlPager_Ex
@sqlstr varchar(8000), --²éѯ×Ö·û´®
@currentpage int, --µÚNÒ³
@pagesize int --ÿҳÐÐÊý,
as
set nocount on
declare @P1 int, --P1ÊÇÓαêµÄid
@rowcount int
exec sp_cursorope ......
Sql ServerÖеÄÈÕÆÚÓëʱ¼äº¯Êý
1. µ±Ç°ÏµÍ³ÈÕÆÚ¡¢Ê±¼ä
select getdate()
2. dateadd ÔÚÏòÖ¸¶¨ÈÕÆÚ¼ÓÉÏÒ»¶Îʱ¼äµÄ»ù´¡ÉÏ£¬·µ»ØÐ嵀 datetime Öµ
ÀýÈ磺ÏòÈÕÆÚ¼ÓÉÏ2Ìì
sele ......