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£¬ÕâÑù²»±ØÈ¥¼
Ïà¹ØÎĵµ£º
Question 1£º
Êý¾Ý¿âµÄÑé֤ģʽΪWindowsÑéÖ¤£¬É¾³ýÁËMS SQL ServerÕʺÅBUILTIN\Administrators,µÇ½²»ÉÏSQL Server¹ÜÀíÆ÷£¿
Answer£º
1.ÖØÐÂÔËÐÐMS SQL SERVERµÄ°²×°³ÌÐò£¬ÔÚ“°²×°Ñ¡ÏçÃæÀïÑ¡Ôñ“¸ß¼¶Ñ¡Ï¬ÏÂÒ»²½ºóÑ¡Ôñ“×¢²á±íÖؽ¨”£¬½ÓÏÂÀ´¸ú° ......
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 ......
SQLiteÊÇÒ»¸ö¾«ÇɵÄÇáÁ¿¼¶Êý¾Ý¿â£¬½ñÌìÖÕÓÚ»ù±¾ÕÆÎÕÁËÈçºÎÓÃC#²Ù×÷SQLiteÊý¾Ý¿â¡£¸ù¾ÝÍøÓÑÃǵľÑ飬ÖÁÉÙÓÐÁ½ÖÖ·½·¨¿ÉÒÔ×öµ½SQLiteµÄµ÷Óã¬Ò»ÖÖÊǵ÷ÓÃsqlite3.dll£¬Ò»ÖÖÊÇÓÃSystem.Data.SQLite£¬¼´sqlite.ADO.NET,ÊÇרΪC sharp·â×°µÄsqliteº¯Êý£¬ºÜÁ÷ÐС£
¼òµ¥Ãè ......
µ±ÄãÕýÔÚ´¦Àí±»¶à¸öÕ¾µã£¨ÏñÔÚ¿ç¹ú¹«Ë¾Ìõ¼þÏ£©Ê¹ÓõĴóÊý¾Ý¿âʱ£¬ÄãÒ²Ðí»áÓöµ½±£Ö¤±í¸ñ¶ÔÏóΨһÐÔÕâÑùµÄ¼¬ÊÖÎÊÌâ¡£ÔÚÕâÖÖÇéÐÎÏ£¬¿ÉÄÜÖ»ÄÜ¿¿UNIQUEIDENTIFIERÀ´½â¾ö¡£UNIQUEIDENTIFIERÊÇÒ»¸ö±£´æÈ«¾ÖΨһ±êʶ·ûµÄGUIDÊý¾ÝÀàÐÍ¡£GUIDÊÇÒ»¸ö±£Ö¤Î¨Ò»µÄ¶þ½øÖÆÊý£¬Òò´Ë¼¸ºõûÓбðµÄ¼ÆËã»ú»á²úÉúͬһ¸öÖµ¡£
GUIDµÄΨһֵÊÇÓÉ¼Æ ......