¿ìËÙÒµÎñͨµÀ

ASP.NETÖÐÀûÓÃVWD²Ù×÷Êý¾Ý¿â

×÷Õß ØýÃû¼¼Êõ À´Ô´ NET±à³Ì ä¯ÀÀ ·¢²¼Ê±¼ä 2012-05-22
ÓÃÏÂÃæµÄ²½Ö裺

1. Ë«»÷½â¾ö·½°¸ä¯ÀÀÆ÷ÖеÄÒ»¸öÒ³Ã棨ÀýÈç"Default.aspx"£©¡£Visual Studio»á´ò¿ªÕâ¸öÒ³Ãæ¡£

2. Ñ¡ÔñÒ³Ãæ´°¿Úµ×²¿µÄ"Éè¼ÆÊÓͼ"±êÇ©Çл»µ½Éè¼ÆÊÓͼ¡£

3. Ë«»÷½â¾ö·½°¸ä¯ÀÀÆ÷ÖеÄÊý¾Ý¿âÎļþ£¨ÀýÈç"Database.mdf"£©¡£Visual StudioΪÁ¬½Ó´ò¿ªÊý¾Ý¿âä¯ÀÀÆ÷¡£

4. Õ¹¿ªTables½ÚµãÒÔÏÔʾÊý¾Ý¿âÖÐµÄ±í¡£

5. °ÑÊý¾Ý¿âä¯ÀÀÆ÷ÖеıíÍϷŵ½Éè¼ÆÊÓͼÖеÄÄǸö´ò¿ªµÄÒ³ÃæÖС£Visual Studio½¨Á¢Ò»¸ö°ó¶¨µ½SqlDataSource¿Ø¼þµÄGridView¡£

6. Õ¹¿ªGridView¿Ø¼þµÄ"ÖÇÄÜÊÂÎñÃæ°å"£¬Ñ¡ÖзÖÒ³¡¢ÅÅÐòºÍ±à¼­¡£

7. °´Ctrl-F5ÔËÐÐÒ³Ã棨ûÓе÷ÊÔ£©¡£

ÏÂÃæµÄÀý×ÓÏÔʾÁËÒ»¸öÁ¬½Óµ½±¾µØÊý¾Ý¿âµÄGridViewºÍSqlDataSource¿Ø¼þ¡£ÎªÁËÔËÐÐÕâ¸öʾÀý£¬ASP.NET½ø³ÌÕʺűØÐëÓµÓÐ~/App_DataĿ¼ÖеÄMDFºÍLDFÎļþµÄ¶Á/дȨÏÞ¡£Õâ¸öȨÏÞÉèÖùý³ÌÈçÏ£º

1. ÔÚWindowsä¯ÀÀÆ÷ÖÐÑ¡ÖÐ~/App_Data/Database.MDFÎļþ²¢Ñ¡Ôñ"ÊôÐÔ"¡£

2. Ñ¡Ôñ"°²È«"±êÇ©²¢µã»÷"Ìí¼Ó"¡£

3. µã»÷"λÖÃ…"£¬Ñ¡ÔñÄãµÄ¼ÆËã»úÃû£¨ÔÚÁÐ±í¶¥²¿£©£¬²¢µã»÷"È·¶¨"¡£

4. ÔÚ¶ÔÏóÃû³ÆÎı¾Çø£¬ÊäÈëASP.NET½ø³ÌÕʺŵÄÃû³Æ¡£ÔÚĬÈÏÇé¿öÏ£¬IIS 6.0ÖеÄÃû³ÆÊÇ"Network Service"£¬IIS 5. xÖеÄÊÇ"ASPNET"¡£

5. ÔÚ"ÔÊÐí"ÁÐÖÐÑ¡ÖÐ"¶Á"ºÍ"д"²¢µã»÷"È·¶¨"¡£

6. Èç¹ûApp_DataĿ¼ÖдæÔÚLDFÎļþ£¬¾ÍÐèÒªÖظ´ÉÏÊö²½Ö裬ÉèÖÃLDFÎļþµÄÊôÐÔ¡£

Èç¹ûÄãʹÓÃVisual StudioÔÚ±¾µØ¼ÆËã»úÉϽ¨Á¢Ó¦ÓóÌÐò£¬ÄÇôÔÚĬÈÏÇé¿öÏ£¬ÄãÊÇÓµÓÐApp_DataĿ¼µÄÉÏÊöȨÏ޵ġ£Èç¹ûij¸öÊý¾Ý¿âÎļþÔÚ±»¸½¼ÓÖ®ºóÐèÒª±ä¸üȨÏÞ£¬Äã±ØÐëÔÚÐÂȨÏÞÉúЧ֮ǰÊ×ÏȹرÕÓ¦ÓóÌÐòÓò£¨application domain£©¡£

£¼asp:GridView AllowSorting="True" AutoGenerateColumns="False"
DataKeyNames="ContactID"
DataSourceID="SqlDataSource1" ID="GridView1" runat="server"£¾
£¼Columns£¾
£¼asp:BoundField DataField="ContactID" HeaderText="ID"
ReadOnly="True" SortExpression="ID" /£¾
£¼asp:BoundField DataField="ContactName" HeaderText="Name"
SortExpression="Name" /£¾
£¼/Columns£¾
£¼/asp:GridView£¾
£¼asp:SqlDataSource ConnectionString="£¼%$ ConnectionStrings:ContactsDatabase %£¾"
ID="SqlDataSource1"
runat="server" SelectCommand="SELECT [ContactID], [ContactName] FROM [Contacts]"
OnSelected="SqlDataSource1_Selected"£¾£¼/asp:SqlDataSource£¾

²¿Êð±¾µØÊý¾Ý¿â

±¾µØÊý¾Ý¿âÎļþµÄÓÅÊÆÖ®Ò»ÔÚÓÚËü¿ÉÒÔ°éËæÓ¦ÓóÌÐò¡¢×÷ΪӦÓóÌÐòµÄÒ»²¿·ÖǨÒƵ½ÆäËüλÖûòÆäËü¼ÆËã»ú£¨µ±È»¸Ã¼ÆËã»úÒ²±ØÐëÔËÐÐSQL Server Express£©¡£ÔÚÒƶ¯Êý¾Ý¿âµÄʱºò£¬¸ÃÎļþ±ØÐë´¦ÓÚ½â³ýËø¶¨£¨unlocked£©×´Ì¬¡£ÔÚÉè¼ÆÆ÷»òÓ¦ÓóÌÐòÁ¬½Óµ½Êý¾Ý¿âµÄʱºò£¬Îļþ»á´¦ÓÚËø¶¨×´Ì¬¡£ÎªÁ˽â³ýËø¶¨£¬Êý¾Ý¿âµÄËùÓлÁ¬½Ó¶¼±ØÐë±»¹Ø±Õ¡£Äã¿ÉÒÔʹÓÃÏÂÃæµÄ¼¼ÊõÀ´¹Ø±ÕÊý¾Ý¿âµÄÁ¬½Ó£º

Èç¹ûASP.NETÒѾ­´ò¿ªÁËÁ¬½Ó£¬Äã¿ÉÒÔͨ¹ý¸øWebÓ¦ÓóÌÐò¸ùĿ¼Ìí¼ÓÒ»¸ö"app_offline.htm"ÎļþÀ´¹Ø±ÕÓ¦ÓóÌÐòÓò¡£ËüµÄ×÷ÓþÍÊǹرÕÓ¦ÓóÌÐòÓò£¨¶ø²»Êǽø³Ì£©²¢°ÑËùÓеÄÓ¦ÓóÌÐòÇëÇóÖض¨Ïò£¨redirect£©µ½Õâ¸öÎļþ£¨·µ»Ø404ÏìÓ¦´úÂ룩¡£Èç¹ûÒªÖØÐÂÆô¶¯Ó¦ÓóÌÐò£¬Ö»ÐèҪɾ³ýÕâ¸öÎļþ¡£Çë×¢Ò⣬¼òµ¥µØÔÚÒ³Ãæ´úÂëÖеĹرÕÁ¬½ÓÊDz»»áÊÍ·ÅÎļþËøµÄ£¬ÒòΪÔÚĬÈÏÇé¿öÏ£¬ADO.NETÁ¬½Ó³Ø»á±£Áô»î¶¯µÄÁ¬½Ó¡£

Visual StudioÌṩÁËCo

ÁèÖڿƼ¼×¨ÒµÌṩ·þÎñÆ÷×âÓᢷþÎñÆ÷Íйܡ¢ÆóÒµÓʾ֡¢ÐéÄâÖ÷»úµÈ·þÎñ£¬¹«Ë¾ÍøÕ¾£ºhttp://www.lingzhong.cn ΪÁ˸ø¹ã´ó¿Í»§Á˽â¸ü¶àµÄ¼¼ÊõÐÅÏ¢£¬±¾¼¼ÊõÎÄÕÂÊÕ¼¯À´Ô´ÓÚÍøÂç,ÁèÖڿƼ¼×ðÖØÎÄÕÂ×÷ÕߵİæȨ£¬Èç¹ûÓÐÉæ¼°ÄãµÄ°æȨÓбØҪɾ³ýÄãµÄÎÄÕ£¬ÇëºÍÎÒÃÇÁªÏµ¡£ÒÔÉÏÐÅÏ¢ÓëÎÄÕÂÕýÎÄÊDz»¿É·Ö¸îµÄÒ»²¿·Ö,Èç¹ûÄúҪתÔر¾ÎÄÕÂ,Çë±£ÁôÒÔÉÏÐÅÏ¢£¬Ð»Ð»!

·ÖÏíµ½£º ¸ü¶à

Copyright ©1999-2011 ÏÃÃÅÁèÖڿƼ¼ÓÐÏÞ¹«Ë¾ ÏÃÃÅÓÅͨ»¥Áª¿Æ¼¼¿ª·¢ÓÐÏÞ¹«Ë¾ All rights reserved

µØÖ·(ADD)£ºÏÃÃÅÈí¼þÔ°¶þÆÚÍûº£Â·63ºÅ701E£¨¶«ÄÏÈÚͨÅÔ£© Óʱà(ZIP)£º361008

µç»°£º0592-5908028 ´«Õ棺0592-5908039 ×ÉѯÐÅÏ䣺web@lingzhong.cn ×ÉѯOICQ£º173723134

¡¶ÖлªÈËÃñ¹²ºÍ¹úÔöÖµµçÐÅÒµÎñ¾­ÓªÐí¿ÉÖ¤¡·ÃöB2-20100024  ICP±¸°¸:ÃöICP±¸05037997ºÅ