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ÔÚÊý¾Ý¿â·ÃÎÊ·½ÃæµÄÒ»¸öÓ¦Óÿò¼Ü£¬ÍêÈ«ÊÇÁ½ÂëÊ¡£
Æä´Î£¬¹ØÓÚ΢Èí»á²»»á·ÅÆú
Ïà¹ØÎĵµ£º
±¾ÎÄÕÂÔ´´ÓÚwww.yafeilinux.com תÔØÇë×¢Ã÷³ö´¦¡£
SQL¼´½á¹¹»¯²éѯÓïÑÔ£¬ÊǹØϵÊý¾Ý¿âµÄ±ê×¼ÓïÑÔ¡£Ç°ÃæÒѾÌáµ½£¬ÔÚQtÖÐÀûÓÃQSqlQueryÀàʵÏÖÁËÖ´ÐÐSQLÓï¾ä¡£ÐèҪ˵Ã÷£¬ÎÒÃÇÕâÀïÖ»ÊÇQt½Ì³Ì£¬¶ø·ÇרҵµÄÊý¾Ý¿â½Ì³Ì£¬ËùÒÔÎÒÃDz»»á¶ÔÊý¾Ý¿âÖеÄһЩ֪ʶ½øÐÐÉîÈë½²½â£¬ÏÂÃæÖ»ÊǶÔ×î³£Óõļ¸¸ö֪ʶµã½øÐн²½â¡£
ÎÒÃÇÏÂÃ ......
±¾ÎÄÕÂÔ´´ÓÚwww.yafeilinux.com תÔØÇë×¢Ã÷³ö´¦¡£
½Ó×ÅÉÏһƪ½Ì³Ì¡£
¶þ£¬ÔÚSQLÓï¾äÖÐʹÓñäÁ¿¡£
ÎÒÃÇÏÈ¿´ÏÂÃæµÄÒ»¸öÀý×Ó£¬½«“²éѯ”°´Å¥µÄ²Ûº¯Êý¸ü¸ÄÈçÏ£º
void Widget::on_pushButton_clicked()
{
QSqlQuery query;
query.prepare(“insert i ......
ÐÞ¸ÄÁÐÊôÐÔ
alter table tablename modify(name ,varchar2(10)) Áпí¶È²»µÃСÓÚÐÞ¸ÄÇ°µÄ¿í¶È
ÈÕÖ¾¹ÜÀí
ÊÓͼ v$logfile
alter database add logfile 'd:\orcl01.log' size 10m;//Ìí¼Ó×é
alter database add logfile member 'd:\orcl02.log' to group 4;//Ïò4×éÖÐÌí¼Ó³ÉÔ±
alter database drop logfile member 'd: ......
Ò»¡¢·Öҳд·¨Ð¡Àý£º
SELECT FIRST 10 templateid,code,name from template ;
SELECT FIRST 10 SKIP 10 templateid,code,name from template ;
SELECT * from shop ROWS 1 TO 10; –firebird2.0Ö§³ÖÕâÖÖд·¨
¶þ¡¢ÏÔʾ±íÃûºÍ±í½á¹¹
SHOW TABLES;
SHOW TABLE tablename;
ËÄ¡¢¸üÐÂ×Ö¶Î×¢ÊÍ
......
Èç¹ûûÓÐÔ¶³ÌÊý¾Ý¿âËùÔÚ·þÎñÆ÷µÄwindowsÕ˺ÅÃÜÂ룬½öÓÐÔ¶³ÌSQL ServerÊý¾Ý¿âµÄÓû§ÃÜÂ룬¸ÃÈçºÎ±¸·ÝÔ¶³ÌÊý¾Ý¿âdb1µÄÊý¾Ýµ½±¾µØÄØ£¿
1£ºÔÚ±¾µØ°²×°Í¨°æ±¾µÄÊý¾Ý¿âÈí¼þ£¨±ÈÈ磺SQL Server2000£©
2£ºÔÚ±¾µØÊý¾Ý¿â·þÎñÆ÷ÉÏ´´½¨Êý¾Ý¿âdb2£»
3£ºÊ¹Óñ¾µØ“ÆóÒµ¹ÜÀíÆ÷”×¢²áÔ¶³ÌÊý¾Ý¿â£¬²¢½ ......