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

LINQ to SQL¿ìËÙÉÏÊÖ step by step

Ç°ÑÔ
      ×î½ü½ÓÁ¬Óöµ½¼¸¸öÅóÓÑÎÊÎÒͬһ¸öÎÊÌ⣬¾ÍÊǹØÓÚ.NETƽ̨ÉÏORM¿ò¼ÜµÄÑ¡Ôñ¡£ÎÒÏëÔÚÕâ¸ö½²ÇóЧÂʵÄʱ´ú£¬Ë­Ò²²»ÏëÊÖдSQL»ò´æ´¢¹ý³ÌÈ¥·ÃÎÊÊý¾Ý¿âÁË¡£´ó¼Ò¶¼ÖªµÀ£¬ÔÚJavaƽ̨ÉÏ£¬ORMÕâÒ»¿é»ù±¾ÊÇHibernateµÄÌìÏ¡£µ±È»£¬Ïà¶ÔÇáÁ¿¼¶µÄiBatisÒ²Óв»´íµÄ±íÏÖ¡£
      ²»¹ý̸µ½.NETƽ̨£¬ORM¿ò¼ÜËƺõÏà¶Ô»ìÂÒÁ˵㡣ºÜ¶àÅóÓÑÎÊÎÒµÄʱºò£¬ÍùÍù»áÕâÑùÎÊ£ºNHibernate¡¢NBearºÍCastle¸ÃÑ¡ÔñÄĸö£¿¶øµ±ÎÒ·´ÎÊ£ºÎªÊ²Ã´²»ÊÊÓÃ΢Èí×Ô´øµÄLinq to SqlÄØ£¿¶Ô·½¾­³£»áÃÔãºÍ²»½â¡£
      ÎÒ¾õµÃÕâÊǸöºÜÆæ¹ÖµÄÏÖÏó¡£ÒÀÕÕÎÒ¸öÈ˵Äʵ¼ù£¬ÎÒÈÏΪµ±ÐèÒª¿ìËÙ¹¹½¨Ò»¸öÖÐСÐÍÏîĿʱ£¬Linq to SqlÊÇÒ»¸öºÜºÃµÄÑ¡Ôñ¡£ÄãÖÁÉÙÓÐÒÔÏÂÀíÓÉ¿ÉÒÔÑ¡ÔñËü£º
     i. ËüÊÇ΢Èí×Ô¼ºµÄ²úÆ·£¬ºÍ.NETƽ̨ÓÐ×ÅÌìÉúµÄÊÊÓ¦ÐÔ¡£Èç¹ûÄãʹÓÃ.NET Framework3.5ºÍVS2008¿ª·¢»·¾³£¬Ëü±¾Éí¾Í¼¯³ÉÔÚÀïÃæÁË£¬Í¬Ê±VS2008¶ÔÓÚLinq to Sql¸øÓèÁËÖî¶à·½±ãµÄÖ§³Ö¡£Ê¹ÓÃËü£¬Äã²»½öÔÚ¿ª·¢ºÍ²¿Êðʱ²»Óÿ¼ÂǵÚÈý·½¿â£¬¸ü¿ÉÒÔ¾¡ÇéÏíÊÜVS2008´øÀ´µÄÖÖÖÖ·½±ã¡£
      ii. ÉÏÊÖÊ®·ÖÈÝÒ×£¬Ê¹ÓÃÊ®·ÖÇáËÉ£¬Í¨³££¬Äã²»ÐèÒª±àдһÐдúÂ룬Ҳ²»ÓÃдÈκÎXMLÅäÖã¬Íêȫͨ¹ý¿ÉÊÓ»¯ÍÏק¾ÍÄÜÍê³ÉORM²ãµÄ¹¹½¨¡£
      iii. ¹¦Äܷḻ£¬Ê¹Óñã½Ý¡£µ±ÇáËɹ¹½¨ºÃORM²ãºó£¬Äã¾Í¿ÉÒÔ¸üÇáËɵIJÙ×ÝÊý¾Ý¿âÁË¡£Linq to SqlÌṩÁ˷ḻµÄ¹¦ÄÜ£¬ÍêÈ«¿ÉÒÔÂú×ãÈÕ³£Êý¾Ý·ÃÎʵÄÐèÇó¡£Ê¹Ó÷½·¨Ò²·Ç³£¼òµ¥¡¢Áé»î¡£
      ÓÐÕâôºÃµÄÀíÓÉ£¬ÎÒÕæÏ벻ͨΪʲôÄÇô¶àÈ˲»Ô¸È¥Ñ¡ÔñËü¡£ÎÒÏëÀ´ÏëÈ¥£¬Ò²ÐíÓÐÁ½¸öÖØÒªÔ­Òò£¬Ò»ÊÇ°ÑLINQºÍLinq to Sql»ìΪһ̸ÁË£¬¶þÊÇÊÜÇ°¶Îʱ¼ä“LINQÒÑËÀ”µÄÎóµ¼£¬¾õµÃ΢ÈíÒѾ­Å×ÆúLinq to SqlÁË¡£¹ØÓÚÕâÁ½µã£¬ÎҾͲ»Ï¸ËµÁË£¬¼òÂÔ³ÎÇåһϣº
      Ê×ÏÈ£¬LINQÊÇ´Ó.NET Framework3.0¿ªÊ¼£¬.NETƽ̨ÉÏÒýÈëµÄÒ»ÖÖÐÂʽÓïÑÔÌØÐÔ£¬ÏÁÒåÒ»µã£¬Äã¿ÉÒÔ½²ËüÀí½â³ÉÒ»ÖÖÐÂʽÓï·¨£¬Ö÷ÒªÊÇÕë¶Ôµü´úÊý¾Ý²Ù×÷µÄ£¬ËùÒÔ£¬Ò²ÐíLINQ½Ð×ö“Êý¾Ýµü´úÒýÇ棨Data Iterative Engine£©”¸üºÏÊÊ£¬Ö®ËùÒÔ²»×ÅÑùÃüÃû£¬ÎÒÏë΢Èí¿ÉÄܲ»Ô¸ÒâÈÃ×Ô¼º²úÆ·µÄ¼òдΪ“DIE”°É¡£:-)¶øLinq to SqlÊÇLINQÔÚÊý¾Ý¿â·ÃÎÊ·½ÃæµÄÒ»¸öÓ¦Óÿò¼Ü£¬ÍêÈ«ÊÇÁ½ÂëÊ¡£
      Æä´Î£¬¹ØÓÚ΢Èí»á²»»á·ÅÆú


Ïà¹ØÎĵµ£º

sql ×óÁ¬½Ó ½âÊÍ

Á¬½Ó²éѯ£¬¾ÍÊǽ«
Á½¸ö»ò¶à¸ö
±í»òÊÓͼ
ͨ¹ýÒ»¶¨µÄÌõ¼þ
½«È«²¿»ò²¿·Ý×Ö¶Î
È«²¿»ò²¿·Ý¼Ç¼
Á¬½Óµ½Ò»Æ𣬵õ½Ò»¸öеÄÊý¾Ý¼¯ºÏ¡£
È磺ÓÐÈËÔ±µµ°¸ºÍ¹¤×ʵµ°¸Á½¸ö±í£¬Á½¸ö±íÓй²Í¬µÄ¹Ø¼ü×Ö¶ÎXMDM(ÐÕÃû´úÂ룩£¬ÆäÖÐÈËÔ±µµ°¸´æ´¢ÁËÈËÊÂ×ÊÁÏ£¬¹¤×ʵµ°¸´æ´¢ÁËн³ê×ÊÁÏ¡£
Òò´Ë¿ÉÒÔͨ¹ýXMDM×ֶν«Á½¸ö±íÁ¬½ÓÆðÀ´£¬´Ó¶øʹ²éѯ½ ......

SQL Server 2005´æ´¢¹ý³Ì¿ª·¢µÄÒ»µã¾­Ñé

1¡¢  ´æ´¢¹ý³Ì
1£©  ¾¡Á¿½«´úÂë¶Î·Åµ½TRY…CATCH…¡£
µ«·²Ê¹ÓÃC#д¹ý´úÂëµÄÈË£¬¶¼ÖªµÀC#ÖÐTRY…CATCH…µÄÔËÐкͳö´íÌøתÂß¼­£¬¶øSQL Server2005ÖУ¬ÆäÔËÐкͳö´íÌøתÂß¼­ÓëÔÚC#ÖÐÊÇÒ»Öµġ£TRY…CATCH…ÊÇSQL Server2005ÖÐÐÂÔöµÄ£¬¹¦ÄÜÇ¿´ó£¬ÇҺܺÃÓá£
2£©&nb ......

sqlС±Ê¼Ç£¨5.26£©

sql server 2005 ¼òµ¥ÔËÓú¯Êý
1.null º¯Êý
  Ó÷¨ÓëoracleÖÐnvl()ÀàËÆ£¬´¦Àíº¯ÊýΪisnull()£¬
  ÀýÈ磺
    select ename,sal+isnull(comm,0)
    from emp
    go
  isnull(comm,0)µÄÓ÷¨ÊÇ£º commΪnull Ôò·µ»Ø0 ·ñÔòΪ commµÄÖµ¡£
2.V ......

sql ÈÕÆÚת»»

Select  
CONVERT(varchar, getdate(), 1),--mm/dd/yy  
CONVERT(varchar, getdate(), 2),--yy.mm.dd  
CONVERT(varchar, getdate(), 3),--dd/mm/yy  
CONVERT(varchar, getdate(), 4),--dd.mm.yy  
CONVERT(varchar, getdate(), 5),--dd-mm-yy  
CONVERT(varchar, getdate(), 1 ......

SQL²éѯÿËùѧУÓïÎijɼ¨×î¸ßµÄѧÉúÐÅÏ¢

Êý¾Ý¿â ÓÐÁ½Õűí
±í1£º student
±í2£ºchinese
ÏÖÔÚÒª·Ö±ðÁгö ÿËùѧУ ÓïÎijɼ¨×î¸ßµÄ ѧÉúÐÅÏ¢
SQL £º
SELECT *
from student
LEFT JOIN chinese ON student.no = chinese.no
WHERE chinese.chengji
IN (
SELECT max( chinese.chengji )
from student
LEFT JOIN chinese ON student.no = chinese.no
GROU ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ