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

ASP.netÁ¬½ÓExcel

Ê×ÏÈÌí¼ÓÃüÃû¿Õ¼ä
using System.Data.OleDb;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
strfile = Request.QueryString["filename"];//´ÓÆäËûÒ³Ãæ´«¹ýÀ´µÄÎļþ·¾¶
Excel(strfile);
}
}

private void Excel(string filepath)
{
try
{
Dataset ds = new DataSet();
string ConnStr = "Provider=Microsoft.Jet.OleDb.4.0;data source=" + filepath +
";Extended Properties='Excel 8.0; HDR=YES; IMEX=1'";//Á¬½ÓExcelµÄ×Ö·û´®
string query = "SELECT * from [student$]";//ExcelÖеıíÃû³Æ
OleDbCommand oleCommand = new OleDbCommand(query, new OleDbConnection(ConnStr));
OleDbDataAdapter oleAdapter = new OleDbDataAdapter(oleCommand);
oleAdapter.Fill(ds, "[student$]");
rowcount = ds.Tables[0].Rows.Count;
gridview1.DataSource = ds;
gridview1.DataBind();
lblmes.Text = "ÉÏ´«³É¹¦£¬Êý¾ÝÈçÏÂËùʾ£¬ÇëÈ·ÈÏ£º";//lblmesΪlabel£¬ÏÔʾÌáʾÐÅÏ¢
}
catch (OleDbException)
{
string filename = filepath.Substring(filepath.LastIndexOf('/') + 1);
lblmes.Text = "´íÎó£¡ÇëÈ·ÈÏÉÏ´«ÎļþÊÇ·ñÕýÈ·£¡µ±Ç°ÉÏ´«µÄÎļþΪ£º" + filename;
lbtnSure.Visible = false;
}
catch(Exception ee)
{
lblmes.Text = ee.Message;
}
}


Ïà¹ØÎĵµ£º

Asp.NET»ñÈ¡Îļþ¼°Æä·¾¶


¡¾Ïà¶Ô·¾¶¡¿
Request.ApplicationPath
/src
Path.GetDirectoryName(HttpContext.Current.Request.RawUrl )
\\src\\Xiaoshe
Context.Request.Path
/src/Xiaoshe/Xiaoshe_New.aspx
Context.Request.CurrentExecutionFilePath
/src/Xiaoshe/Xiaoshe_New.aspx
Context.Request.FilePath
/src/Xiaoshe/Xiaoshe ......

ʹÓÃ×Ô¶¨ÒåÕ¾µãµØÍ¼Ìṩ³ÌÐò¿ØÖÆASP.NETµÄ²Ëµ¥

         ASP.NETÌṩµÄÕ¾µãµØÍ¼ÎªÎÒÃǽ¨Á¢µ¼º½À¸ºÍ²Ëµ¥ÌṩÁ˼«´óµÄ·½±ã¡£´ËÍâÎÒÃÇ»¹¿ÉÒÔ½¨Á¢×Ô¼ºµÄÕ¾µãµØÍ¼Ìṩ³ÌÐò£¬´Ó¶øÊ¹ÎÒÃǵIJ˵¥Ïî¿É¿Ø¡£
 
    ÏÈÀ´Á˽âÏÂmenuµÈµ¼º½¿Ø¼þÓëÕ¾µãµØÍ¼µÄ¹ØÏµ¡£ÎÒÃÇÔÚASP .NETÏîÄ¿ÖÐËù½¨Á¢µÄweb.siteMap Æäʵ¾ÍÊÇÒ»¸ö× ......

Win7ÏÂÅäÖÃIIS½Å±¾Ó³ÉäʵÏÖAsp.NetµÄHttp¹ÜµÀ³ÌÐò

 
       Asp.Net³ÌÐòµÄ¸ß¼¶¹¦ÄÜ£¬Óкܶ඼ÊÇ»ùÓÚIHttpHandler½Ó¿ÚÀ´ÊµÏֵģ¬ÔÚWinwods Server 2003 Ï£¬ÅäÖÃIIS6µÄ Web·þÎñÀ©Õ¹·Ç³£¼òµ¥¡£×î½üÓÃWin7+IIS7.5µÄÈËÔ½À´Ô½¶à£¬ÔÚÕâ¸ö»·¾³ÏÂÅäÖÃAsp.NetµÄWeb·þÎñÀ©Õ¹¾ÍÓÐЩÂé·³¡£ÒÔÏÂÄÚÈÝ£¬¾ÍÊÇÔÚWin7ºÍIIS7.5»·¾³ÏÂÅäÖùý³Ì¡£
 
& ......

ASP.NET µÇ¼½çÃæ

//default.aspx.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Data.OleDb;
using System.Data.SqlClient;
using System.Runtime.InteropService ......

ASP.NETÖб³¾°ÒôÀֵĴ¦Àí

ÔÚASP.NETµÄSOUCEÖУ¬²»»á´æÔÚBGSOUNDÕâ¸ö±êÇ©£¬µ«ÊÇ£¬Èç¹ûÎÒÏë²åÈëÒ»¶Î±³¾°ÒôÀÖÔõô°ì£¿
ÎÒÕâÀïÓÐÁ½ÖÖ½â¾ö·½·¨£º
1¡¢Ð´ÈëÒ»¸öÍøÒ³²¥·ÅÆ÷£¬µ«ÊÇÕâÑù£¬±¾ÈËÈÏΪºÜ¸´ÔÓ£¬¶øÇÒ£¬ÎÒÒ²²»»á
2¡¢ÓÃIFRAMEǶÌ×Ò»¸öHTMLÍøÒ³£¬½«IFRAMEµÄµÄWIDTHºÍHEIGHT¶¼ÉèÖóÉ0PX£¬¼´¿É¡£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ