asp.net ʵÏÖexcelµ¼Èëµ½Êý¾Ý¿â
//ExcelÅúÁ¿µ¼Èëµ½Êý¾Ý¿â
protected void btnUpload_Click(object sender, EventArgs e)
{
string IsXls = System.IO.Path.GetExtension(UploadExcel.FileName.ToString().ToLower());
if (IsXls != ".xls")
{
Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script type='text/javascript' language='javascript'>alert('Ö»¿ÉÒÔÑ¡ÔñExcelÎļþ');location.href='EmployeeAddPage.aspx';</script>");
return;//µ±Ñ¡ÔñµÄ²»ÊÇExcelÎļþʱ,·µ»Ø
}
string filePath = UploadExcel.PostedFile.FileName;
string fileName = UploadExcel.FileName;
DataSet ds = ExecleDs (filePath,fileName);
CommonLayer.employeeModel model = new CommonLayer.employeeModel();
DataAcessLayer.employee_infomation addlist = new DataAcessLayer.employee_infomation();
if (ds.Tables[0].Rows.Count > 0)
{
int row = ds.Tables[0].Rows.Count-1;
for (int i = 0; i < ds.Tables[0].Select().Length; i++)
{
&
Ïà¹ØÎĵµ£º
ÎÊ£ºÎªÊ²Ã´SessionÔÚÓÐЩ»úÆ÷ÉÏż¶û»á¶ªÊ§£¿
´ð£º¿ÉÄܺͻúÆ÷µÄ»·¾³ÓйØÏµ£¬±ÈÈ磺·À»ðǽ»òÕßɱ¶¾Èí¼þµÈ£¬³¢ÊԹرշÀ»ðǽ¡£
ÎÊ£ºÎªÊ²Ã´µ±µ÷ÓÃSession.Abandonʱ²¢Ã»Óм¤·¢Session_End·½·¨£¿
´ð£ºÊ×ÏÈSession_End·½·¨Ö»Ö§³ÖInProc£¨½ø³ÌÄڵģ©ÀàÐ͵ÄSession¡£Æä´ÎÒª¼¤·¢Session_End·½·¨£¬±ØÐë´æÔÚSession£¨¼´ÏµÍ³ÖÐÒÑ¾Ê¹Ó ......
private bool IsPicture(string filePath)//filePathÊÇÎļþµÄÍêÕû·¾¶
{
try
......
1.¶Á³ö·½Ê½
DataReaderºÍDataSet¶¼¿ÉÒÔʵÏÖ¶ÔÊý¾Ý¿âÊý¾ÝµÄ²éѯ·µ»Ø£¬µ«Ç°ÕßÖ»ÄÜÌṩ¿ìËٵIJéѯ·½Ê½£¬ºóÕß»¹¿ÉÒÔʵÏÖ¶ÔÊý¾ÝµÄÌí¼Ó¡¢Ð޸ġ¢É¾³ý¹¦ÄÜ¡£
£¨1£©DataReader·½Ê½¶ÁÈ¡£º
string sConnString = "server=localhost;User Id=root;password=root;Persist Security Info=True;database=db_user";
MySqlConnection myC ......
1 ʹÓñê×¼HTMLÀ´½øÐÐͼƬÉÏ´«
ǰ̨´úÂ룺
<body>
<form id="form1" runat="server">
<div>
<table>
&nbs ......
asp.netÉú³É¾²Ì¬Ò³ÃæÍ¨³£»áÓÐ2Öз½Ê½£¬Ò»ÖÖÊÇα¾²Ì¬£¬Ò»ÖÖÊÇÊÂÏÈдºÃÄ£°åÈ»ºóÖ±½ÓÌæ»»ÄÚÈÝ¡£¶ÔÓÚ2ÖÖ·½Ê½µÄÓÅȱµã£¬Ôڴ˲»ÌÖÂÛ£¬ÖصãÊÇ˵ϵڶþÖÖ·½Ê½£¬ÔÚÉú³É¾²Ì¬Ò³ÃæÖÐÓÐһЩÐÅÏ¢ÐèҪʵʱ´ÓÊý¾Ý¿â¶ÁÈ¡£¨±ÈÈ磺ÔÚÐÂÎÅÒ³Ãæ£¬ÎÒÃÇ»áÐèҪһЩÈȵãÅÅÐУ¬ÕâЩÈȵãÐÂÎÅÎÒÃǾÍÐèҪʵʱµÄ´ÓÊý¾Ý¿âÀï±ßÄõ½£©¡£
......