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

asp.net¶ÁÈ¡exclÖеÄÊý¾Ý¡¾×ª¡¿

¾­³£ÐèÒªÔÚÊý¾Ý¿âÓëExeclÖ®¼ä»¥µ¼Êý¾Ý¡£netʱ´ú£¬ADO.NET¿ÉÒÔʹÓÃʹÓÃMicrosoft.Jet.OleDb·ÃÎÊ·ÃÎÊExcel£¬ÍøÉÏÒѾ­ÓкܶàÀàËƵÄ×ÊÔ´£¬×îµäÐÍÒ²ÊÇ×î¼òµ¥µÄ¿ÉÄÜÈçÏ£º£¨asp.net»·¾³£©
 // Á¬½Ó×Ö·û´®           
        string xlsPath = Server.MapPath("~/app_data/somefile.xls"); // ¾ø¶ÔÎïÀí·¾¶
        string connStr = "Provider=Microsoft.Jet.OLEDB.4.0;" +
                        "Extended Properties=Excel 8.0;" +
                        "data source=" + xlsPath;
        // ²éѯÓï¾ä
        string sql = "SELECT * from [Sheet1$]";
        DataSet ds = new DataSet();
        OleDbDataAdapter da = new OleDbDataAdapter(sql, connStr);
        da.Fill(ds);    // Ìî³äDataSet       
       
        // ÔÚÕâÀï¶ÔDataSetÖеÄÊý¾Ý½øÐвÙ×÷       
        // Êä³ö£¬°ó¶¨Êý¾Ý
        GridView1.DataSource = ds.Tables[0];
        GridView1.DataBind();
ºÜ¼òµ¥°É£¿£¡Ò»ÇоÍÏñ²Ù×÷Êý¾Ý¿âÒ»Ñù£¬Ö»ÊÇÐèҪעÒâµÄÊÇ£º
1¡£Êý¾ÝÌṩ³ÌÐòʹÓÃJet£¬Í¬Ê±ÐèÒªÖ¸¶¨Extended Properties ¹Ø¼ü×ÖÉèÖà Excel Ìض¨µÄÊôÐÔ£¬²»Í¬°æ±¾µÄExcel¶ÔÓ¦²»Í¬µÄÊôÐÔÖµ£ºÓÃÓÚ Extended Properties ÖµµÄÓÐЧ Excel °æ±¾¡£
¶ÔÓÚ Microsoft Excel 8.0 (97)¡¢9.0 (2000) ºÍ 10.0 (2002) ¹¤×÷²¾£¬ÇëʹÓà Excel 8.0¡£
¶ÔÓÚ Microsoft Excel 5.0 ºÍ 7.0 (95) ¹¤×÷²¾£¬Çë


Ïà¹ØÎĵµ£º

asp.net×°Ôؽø¶ÈÌõ¼°¹¤×÷Ò³Ãæ¿ò¼ÜÔ­ÀíºÍʵÏÖ

asp.net×°Ôؽø¶ÈÌõ¼°¹¤×÷Ò³Ãæ¿ò¼ÜÖ÷ÒªÓÉ4¸ö²¿·Ö×é³É,Õâ4¸ö²¿·ÖµÄÃû³Æ¼°ÔÚÕû¸ö¿ò¼ÜÖÐËùÆðµ½µÄ×÷ÓÃÈçÏÂ:
1.Èë¿ÚÁ´½ÓµØÖ·Ò³Ãæ(aspx):±ÈÈç,µÇ¼ҳÃæ.Ìṩµ½Ä¿±êµØÖ·µÄÒ»¸öÁ´½Ó,²¢Ïò¸ÃÄ¿±ê´«µÝһЩÆô¶¯±ØÐëµÄ»ù±¾Á´½Ó²ÎÊý.
2.Èë¿ÚÁ´½ÓÄ¿±êÒ³Ãæ(aspx):¸ÃÄ¿±ê¶ÔÏóÊÇÕû¸ö¿ò¼ÜµÄºËÐÄ,Ò³Ãæ×°ÔØʱͨ¹ýdocument.writeÊä³ö2¸öiframe,Æä ......

Asp.netÒ³ÃæºÍÓû§¿Ø¼þ¼äµÄ´«Öµ

¿´µ½ºÜ¶àÅóÓÑÎÊÕâ¸öÎÊÌâ,ËäÈ»ºÜ¼òµ¥,µ«ÊǺܳ£ÓÃ,ÄóöÀ´ÌÖÂÛÏ°ɡ£¡£¡£¸ßÊÖÆ®¹ý£¡
¼ÇµÃ¼¸Äêǰż¸Õѧ.NETµÄʱºòżÊÇÕâÑù¸ÉµÄ
+Õ¹¿ª-C#
<%@ Control Language="c#" %>
//html...
<script runat="server">
public string BackClo ="red"; //ÕâÀﶨÒåÁËÒ»¸ö²ÎÊý
public void Page_Load()
{ }
</sc ......

ASP.NET µÄһЩ³£Óü¼Çɱ¸Íü1

1 »ñÈ¡´íÎóÐÅÏ¢²¢µ½Ö¸¶¨Ò³Ã治ҪʹÓÃResponse.Redirect,¶øÓ¦¸ÃʹÓÃServer.Transfer
e.g
// in global.asax
protected void Application_Error(Object sender, EventArgs e) {
if (Server.GetLastError() is HttpUnhandledException)
Server.Transfer("MyErrorPage.aspx");
//ÆäÓàµÄ·ÇHttpUnhandledExceptio ......

ASP.NETʹÓÃRequest»ñÈ¡À´Ô´ÍøÖ·URL²ÎÊý

Request¶ÔÏó¹¦ÄÜÊÇ´Ó¿Í»§¶ËµÃµ½Êý¾Ý£¬³£ÓõÄÈýÖÖÈ¡µÃÊý¾ÝµÄ·½·¨ÊÇ£ºRequest.Form¡¢Request.QueryString£¬Request¡£ÆäµÚÈýÖÖÊÇÇ°Á½ÖÖµÄÒ»¸öËõд£¬¿ÉÒÔÈ¡´úÇ°Á½ÖÖÇé¿ö¡£¶øÇ°Á½ÖÖÖ÷Òª¶ÔÓ¦µÄFormÌύʱµÄÁ½ÖÖ²»Í¬µÄÌá½»·½·¨£º·Ö±ðÊÇPost·½·¨ºÍGet·½·¨¡£
        Request ¶ÔÏóµÄÊôÐԺͷ½·¨± ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ