ASP.NET±à³ÌÖеÄÊ®´ó¼¼ÇÉ
ÔÚ±¾ÆªÎļþÖУ¬ÎÒÃǽ«ÌÖÂÛ±à³ÌÈËÔ±ÔÚʹÓÃASP.NET¿ª·¢Ó¦ÓóÌÐòʱÐèҪעÒâµÄ10¸ö¼¼ÇÉ£¬ÕâЩ¼¼ÇÉÉæ¼°´ÓȱʡµÄ¿Ø¼þ¡¢±íµ¥ÃûµÄ¸Ä±äµ½StringBuilderÀàµÄʹÓã¬ÓÐÖúÓÚ±à³ÌÈËÔ±Äܹ»¾¡¿ìµØÊÊÓ¦.NET»·¾³¡£ 1¡¢ÔÚʹÓÃVisual Studio .NETʱ£¬³ýÖ±½Ó»ò·ÇÒýÓõĶÔÏóÍ⣬²»ÒªÊ¹ÓÃȱʡµÄÃû×Ö¡£
.NET´øÀ´µÄºÃ´¦Ö®Ò»ÊÇËùÓеÄÔ´´úÂëºÍÅäÖÃÎļþ¶¼ÊÇ´¿Îı¾Îļþ£¬Äܹ»Ê¹ÓÃNotepad»òWordPadµÈÈÎÒâµÄÎı¾±à¼Æ÷½øÐб༡£Èç¹û²»Ô¸Ò⣬ÎÒÃDz¢·ÇÒ»¶¨ÒªÊ¹ÓÃVisual Studio .NET×÷Ϊ¼¯³É¿ª·¢»·¾³¡£µ«Ê¹ÓÃÁËVisual Studio .NET£¬ÎÒÃÇ¿ÉÒÔÔÚWindowsÎļþ¹ÜÀíÆ÷Öп´µ½Îļþ£¬»òÔÚVisual Studio .NETÖ®Íâ´ÓÎı¾±à¼Æ÷ÖÐä¯ÀÀÎļþµÄÄÚÈÝ¡£
ʹÓÃVisual Studio .NET×÷Ϊ¼¯³É¿ª·¢»·¾³ÓÐÐí¶àºÃ´¦£¬ÆäÖÐ×îÏÔ×ŵĺô¦ÊÇËü¼«´óµØÌá¸ßÁËÉú²úЧÂÊ¡£Ê¹ÓÃVisual Studio. NET£¬ÎÒÃÇÄܹ»ÔÚ¸¶³ö½ÏС´ú¼ÛµÄÇé¿öϸü¿ìµØ¿ª·¢Èí¼þ¡£×÷Ϊ¼¯³É¿ª·¢»·¾³Ò»²¿·ÖµÄIntelliSenseÌṩ×Ô¶¯µÄ´úÂëÍê³É¡¢ÔÚÊäÈë·½·¨»òº¯ÊýʱÌṩ¶¯Ì¬°ïÖú¡¢Óï·¨´íÎóµÄʵʱÌáʾ£¬ÒÔ¼°ÆäËûÄܹ»Ìá¸ßÉú²úЧÂʵŦÄÜ¡£
ÏóÆäËû¸´ÔӵŤ¾ßÄÇÑù£¬ÔÚѧ»áÈçºÎ³ä·Ö·¢»ÓËüµÄ×÷ÓúÍÕÆÎÕÆä“Ï°ÐԔǰ£¬Visual Studio .NETÒ²»áʹÎÒÃDzúÉúÒ»ÖÖ´ìÕ۸С£ÓÐʱ£¬ËüÏóÒ»¸öÄÑÒÔÁ˽âµÄºÚºÐ×Ó£¬»áÉú³É´óÁ¿µÄÎļþºÍÐí¶àÎÞÓõĴúÂë¡£
Visual Studio .NETµÄÒ»¸ö¹¦ÄÜÊÇ£¬ÎÞÂÛÊÇÀà¡¢¿Ø¼þ»ò±íµ¥ÖеĶÔÏó£¬Ëü¶¼Äܹ»ÎªÐ¶ÔÏóÌṩȱʡÃû×Ö¡£ÀýÈ磬Èç¹ûÎÒÃÇ´´½¨ÁËÒ»¸öеÄASP.NET Web Application£¬ÆäȱʡµÄÃû×Ö½«ÊÇWebApplication1¡£ÎÒÃÇ¿ÉÒÔÔړй¤³Ì”¶Ô»°¿òÖз½±ãµØ¸Ä±ä¸ÃÓ¦ÓõÄÃû×Ö£¬µ«Í¬Ê±¸Ä±äµÄÖ»ÊǸÃÓ¦ÓóÌÐòµÄÃû×Ö¿Õ¼äµÄÃû×Ö¼°ÆäËùÔÚµÄÐéÄâĿ¼£¬Ô´´úÂëÎļþµÄȱʡÃû×ÖÈÔÈ»ÊÇWebForm1.aspxºÍWebForm1.aspx.cs£¨C#¹¤³Ì£©»òWebForm1.aspx.vb£¨VB.NET¹¤³Ì£©¡£
ÎÒÃÇ¿ÉÒÔÔÚ·½°¸ä¯ÀÀÆ÷ÖиıäASPXºÍ´úÂëʹÓõÄÎļþÃû×Ö£¬µ«WebÒ³ÀàµÄÃû×ÖÈÔÈ»½«ÊÇWebForm1¡£Èç¹ûÔÚ¸ÃWeb±íµ¥ÉÏÉú³ÉÒ»¸ö°´Å¥£¬ÆäȱʡµÄÃû×Ö½«ÊÇButton1¡£ÊÂʵÉÏ£¬ËùÓпؼþµÄÃû×Ö¶¼ÊÇÓɿؼþµÄÀàÐͺÍÊý×Ö×é³ÉµÄ¡£
ÎÒÃÇÄܹ»£¬Ò²Ó¦¸Ã½«Ó¦ÓóÌÐòÖÐËùÓÐµÄ±íµ¥ºÍ¿Ø¼þµÄÃû×Ö¶¼Ð޸ijÉÓÐÒâÒåµÄÃû×Ö¡£¶ÔÓÚ½ÏСµÄÑÝʾÐÔ³ÌÐò¶øÑÔ£¬È±Ê¡µÄÃû×Ö»¹Äܹ»Ê¤ÈΣ¬µ«Èç¹ûÓ¦ÓóÌÐòÓɶà¸ö±íµ¥£¬Ã¿¸ö±íµ¥ÉÏÓÐÐí¶à°´Å¥ºÍ±êǩʱ£¬ÏófrmStartup¡¢frmDataEntryºÍfrmReportsÕâÑùµÄ±íµ¥Ãû¾Í±ÈForm1¡¢Form2ºÍForm3ÕâÑùµÄÃû×Ö¸üÒ×ÓÚÀí½âºÍά»¤¡£
Èç¹û±íµ¥ÉϿؼþÒªÔÚ´úÂëµÄÆäËûµØ·½ÒýÓã¬Ê¹ËüÓÐÒ»¸öÓÐÒâÒåµÄÃû×
Ïà¹ØÎĵµ£º
ÔÚASP.NETÓ¦ÓóÌÐò³£³£»áÓöµ½ÐèÒª´ÓExcelÎļþÖжÁÈ¡Êý¾Ý»ò½«Êý¾ÝдÈëExcelµÄÐèÇó¡£Ò»°ãÀ´½²£¬ÔÚASP.NETÖжÁдExcelÎļþÓÐËÄÖÖ½â¾ö·½°¸¡£
1.1.1 ʹÓÃOLE DB
ʹÓÃOLE DB¿ÉÒÔÒÔ²éѯÊý¾Ý¿âµÄ·½Ê½À´¶ÁÈ¡ExcelÎļþ£¬ÒòΪÔÚijÖ̶ֳÈÉÏExcel±í¸ñ¿ÉÒÔ¿´³ÉÊÇÒ»ÕÅÒ»ÕŵÄÊý¾Ý±í¡£Æä¶þÕßµÄÖ÷ÒªÇø±ðÔÚÓÚËùʹÓõÄÊý¾ÝÒýÇæ²»Ò»Ñù¡£Ê¹ÓÃOLE ......
ASP.NETÒ³Ãæˢз½·¨×ܽá
ÏÈ¿´¿´ASP.NETÒ³ÃæˢеÄʵÏÖ·½·¨£º
µÚÒ»£º
private void Button1_Click(objectsender,System.EventArgse)
{
Response.Redirect(Request.Url.ToString());
}
µÚ¶þ£º
private void Button2_Click(objectsender,System.EventArgse)
{
Response.Write("<mce:script language=javascript& ......
ÔÚÄãµÄPage_LoadÖÐÌí¼ÓÕâÑùµÄ´úÂë:
Page.Response.Clear();
bool success = ResponseFile(Page.Request, Page.Response, "Ä¿µÄÎļþÃû³Æ", @"Ô´Îļþ·¾¶", 1024000);
if (!success)
Response.Write("ÏÂÔØÎļþ³ö´í£¡");
Page.Response.End();
ÎļþÏÂÔغ¯Êý´úÂëΪ:
public static bo ......
1.ÈçºÎÔÚJavaScript·ÃÎÊC#º¯Êý?
·½·¨Ò»£º1¡¢Ê×ÏȽ¨Á¢Ò»¸ö°´Å¥£¬ÔÚºǫ́½«µ÷Óûò´¦ÀíµÄÄÚÈÝдÈëbutton_clickÖÐ;
2¡¢ÔÚǰ̨дһ¸öjsº¯Êý£¬ÄÚÈÝΪdocument.getElementById("btn1").click();
3¡¢ÔÚǰ̨»òºóÌ ......
using System.Text.RegularExpressions; //ÒýÈëµÄÃüÃû¿Õ¼ä
ÒÔÏÂΪÒýÓõÄÄÚÈÝ£º
//Çå³ýHTMLº¯Êý
public static string NoHTML(string Htmlstring)
{
//ɾ³ý½Å±¾
Htmlstr ......