Linq To Sql½ø½×ϵÁУ¨Ò»£© ´ÓÓ³Éä½²Æð
±¾ÏµÁУ¬»ò¶à»òÉÙ£¬Ö±½Ó»ò¼ä½ÓÒÀÀµÈëÃÅϵÁÐ֪ʶ¡£µ«£¬ÒÀÈ»×·Çó¶ÀÁ¢³ÉÕ¡£Òò±¾ÎÄ×÷ÕßˮƽÓÐÏÞ£¬ÎÄÖдíÎóÄÑÃ⣬¾´Çë¶ÁÕßÖ¸³ö²¢Á½⡣±¾ÏµÁн«»áºÍÈëÃŲ¢´æ¡£
°¸Àý
ij¾ý±»ÑûΪһ³¬ÊÐÉè¼ÆÊý¾Ý¿â£¬ÓÃÀ´´æ´¢Êý¾Ý¡£¸Ã¾ý¸ù¾Ý¸Ã³¬ÊÐÖÐʵ¼Ê³öÏֵĶÔÏó£¬Éè¼ÆÁËCustomer, Employee£¬Order, ProductµÈ±í£¬ÓÃÀ´±£´æÏàÓ¦µÄ¿Í»§£¬Ô±¹¤£¬¶©µ¥£¬»õÆ·µÈ¡£Ì«ºÃÁË£¬¸Ã¾ýºÜÓÐooµÄ˼ÏëÂð¡£
Èç¹û£¬Äã±»ÒªÇóÓÃÀ༰¶ÔÏó£¬À´ÃèÊö¸Ã¹ØϵÐÍÊý¾Ý£¬Äã¸ÃÈçºÎ×öÄØ£¿ÔÚlinqÍƳö֮ǰ£¬ADO.NET±»ÓÃÀ´×öÊý¾Ý·ÃÎʲ㡣¶øºó£¬³ÌÐòÔ±ÐèÒª×Ô¼ºÈ¥±àдÊÂÎñÂß¼²ãÖÐËù³öÏÖµÄÀà¡£±ÈÈ磬Customer, Employee£¬Order, ProductµÈ¡£È»ºó£¬³ÌÐòÔ±×é×°ËùÐèµÄsqlÓï¾ä£¬Í¨¹ýADO.NET£¬½«·µ»ØµÄ¼Ç¼£¬À´³õʼ»¯CustomerµÈÀàµÄ¶ÔÏó¡£ÔÚÕâÀÄãÒѾ×Ô¼º¶¯ÊÖ½«Customer±íºÍCustomerÀà¹ØÁªÁËÆðÀ´¡£´ÓLinq To SqlµÄÉè¼ÆÀ´¿´£¬ËüÖ÷ÒªÊÇΪÁ˽â¾ödata!=objects µÄÎÊÌâ¶ø²úÉúµÄ¡£ÏÖÔÚ£¬ÓÐÁËTableºÍClassÖ®¼äµÄÓ³É䣬Êý¾ÝºÍ¶ÔÏóÖ®¼ä¾Í¿ÉÒÔÓÐÒ»¸öÒ»Ò»¶ÔÓ¦µÄ¹ØϵÁË¡£
ÔÚLinq To Sql֮ǰ£¬ÔÚjavaÁìÓòÓÐHibernate£¬ÔÚnetÁìÓòÓÐNHibernate¼¼Êõ£¬À´ÊµÏÖobject/relational ³Ö¾ÃºÍ²éѯ·þÎñ¡£ÎÞÂÛÊÇHibernate»¹ÊÇNHibernate£¬ÆäÅäÖø´ÔÓ£¬ÉÏÊÖʱ¼ä³¤£¬ÒѾ²»ÄÜÊÊÓ¦¿ìËÙ¿ª·¢µÄÐèÒª¡£¶øLinq To SqlµÄÍƳö£¬Ç¡Ç¡ÃÖ²¹ÁËËüÃǵÄȱµã£¬³¹µ×½µµÍÁ˳ÌÐò¿ª·¢Ãż÷¡£
Linq
LinqÊÇLanguage Integrated QueryµÄËõд¡£Linq To SqlÊÇlinqÖеÄÒ»²¿·Ö£¬ÆäÓëADO.NET OrcasµÄ¹ØϵÈëÏ¡£
ÏÖÔÚlinq·ÖÈý¸ö²¿·Ö¡£Linq To Objects£¬¼´ÒÔÇ°µÄlinq¡£ÆäÖ÷ÒªÊÇÕë¶ÔCLR-Based ObjectsµÄ²éѯ¡£¼´ÄÚ´æ²Ù×÷¡£Linq Enabled ADO.NETÊÇÕë¶Ô¹ØϵÐÍÊý¾ÝµÄ¡£ÕâÓÖ°üº¬Èý¸ö²¿·Ö¡£Linq To Datasets, Linq To Sql, Linq To Entities. ÆäÖÐLinq To Sql ÊÇ´ó¼ÒËùÊìϤµÄ²¿·Ö£¬¼´ÒÔÇ°µÄDlinq. ¹Ù·½µÄ½âÊÍÊÇ£¬Linq To Datasets, support for ADO.NET Datasets; Linq to SQL, support for SQL Server; Linq to Entities, Support fro Entity Data Model. ¼ÇµÃ£¬ÒÔÇ°ÔøÓÐÈËÎʼ°dlinqÓëADO.NET OrcasµÄ¹Øϵ£¬ÒòΪËüÃÇÁ¥ÊôÓÚ²»Í¬µÄ¶ÓÎ鿪·¢£¬ÆäÖÐÓÐÖصþµÄ²¿·Ö¡£¶øÏÖÔÚ£¬Æ书Äܹé½áÔÚÒ»Æð£¬ÆäÖصþ²¿·ÖÒѾµÃµ½Èںϡ££¨Èç¹ûÓÐÈËÊÇADO.NET team»òÊìϤÕâ¸öµÄ£¬¿ª±ÙרÀ¸¸øÎÒÃÇ´ó¼Ò½²Ò»ÏÂѽ¡££©×îºóÒ»²¿·Ö½ÐLinq To XML£¬¼´ÒÔÇ°µÄXlinq. Õë¶Ôxml¸ñʽÊý¾ÝµÄ²Ù×÷¡££¨»¹ÓÐÕë¶ÔASP.NETµÄBlinq, ´óÉùÎÊһϣ¬ÓÐûÓÐÈ˶®Õâ¸öѽ£©
DBML
Ëùνdbml£¬¼´Database Mark Language¡£Êý¾Ý¿âÃèÊöÓïÑÔ£¬Ê
Ïà¹ØÎĵµ£º
SQL SERVER 2000ÓÃsqlÓï¾äÈçºÎ»ñµÃµ±Ç°ÏµÍ³Ê±¼ä
¾ÍÊÇÓÃGETDATE();
SqlÖеÄgetDate()2008Äê01ÔÂ08ÈÕ ÐÇÆÚ¶þ 14:59
Sql Server ÖÐÒ»¸ö·Ç³£Ç¿´óµÄÈÕÆÚ¸ñʽ»¯º¯Êý
Select CONVERT(varchar(100), GETDATE(), 0): 05 16 2008 10:57AM
Select CONVERT(varchar(100), GETDATE(), 1): 05/16/08
Select CONVERT(varchar(100), ......
Ò»¡¢»ù´¡
1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿â
Create DATABASE database-name
2¡¢ËµÃ÷£ºÉ¾³ýÊý¾Ý¿â
drop database dbname
3¡¢ËµÃ÷£º±¸·Ýsql server
--- ´´½¨ ±¸·ÝÊý¾ÝµÄ device
USE master
EXEC sp_addumpdevice disk, testBack, c:mssql7backupMyNwind_1.dat
--- ¿ªÊ¼ ±¸·Ý
BACKUP DATABASE pubs TO testBack
4¡¢Ë ......
MSSQL:
declare @begin datetime
declare @End datetime
set @begin=getdate()
--Ö´ÐеÄÓï¾äдÔÚÕâÀï
set @End=getdate()
select datediff(millisecond,@begin,@End) as Ö´ÐеÄʱ¼ä
--millisecond±íʾºÁÃë Èç¹û¿´Ãë¿ÉÒÔʹÓÃss
C#:
ºÜ¶àʱº ......
Statement µÄ execute(sql) ·½·¨µÄ·µ»ØÖµ
true if the first result is a ResultSet object;
false if it is an update count or there are no ......
SQL Injection with MySQL
±¾ÎÄ×÷Õߣºangel
ÎÄÕÂÐÔÖÊ£ºÔ´´
·¢²¼ÈÕÆÚ£º2004-09-16
±¾ÎÄÒѾ·¢±íÔÚ¡¶ºÚ¿Í·ÀÏß¡·7Ô¿¯£¬×ªÔØÇë×¢Ã÷¡£ÓÉÓÚдÁ˺ܾã¬Ëæ׿¼ÊõµÄ½ø²½£¬±¾ÈËÒ²·¢ÏÖ¸ÃÎÄÀïÓв»ÉÙ´íÎóºÍÂÞàµĵط½¡£Çë¸÷λ¸ßÊÖ¿´Á˲»ÒªÐ¦¡£±¾ÎÄдÓÚ¡¶Advanced SQL Injection with MySQL¡·Ö®Ç°Ò»¸öÔ¡£
ÉùÃ÷
¡¡¡¡±¾ÎĽöÓÃÓÚ½ ......