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

ASP.NET¶ÁÈ¡EXCELÎļþµÄÈýÖÖ·½·¨


1.·½·¨Ò»£º²ÉÓÃOleDB¶ÁÈ¡EXCELÎļþ£º
°ÑEXCELÎļþµ±×öÒ»¸öÊý¾ÝÔ´À´½øÐÐÊý¾ÝµÄ¶ÁÈ¡²Ù×÷£¬ÊµÀýÈçÏ£º
public DataSet ExcelToDS(string Path)
{
string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" +"Data Source="+ Path +";"+"Extended Properties=Excel 8.0;";
OleDbConnection conn = new OleDbConnection(strConn);
conn.Open();  
string strExcel = "";   
OleDbDataAdapter myCommand = null;
DataSet ds = null;
strExcel="select * from [sheet1$]";
myCommand = new OleDbDataAdapter(strExcel, strConn);
ds = new DataSet();
myCommand.Fill(ds,"table1");   
return ds;
}
¶ÔÓÚEXCELÖÐµÄ±í¼´sheet([sheet1$])Èç¹û²»Êǹ̶¨µÄ¿ÉÒÔʹÓÃÏÂÃæµÄ·½·¨µÃµ½
string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" +"Data Source="+ Path +";"+"Extended Properties=Excel 8.0;";
OleDbConnection conn = new OleDbConnection(strConn);
DataTable schemaTable = objConn.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Tables,null);
string tableName=schemaTable.Rows[0][2].ToString().Trim();  
ÁíÍ⣺Ҳ¿É½øÐÐдÈëEXCELÎļþ£¬ÊµÀýÈçÏ£º
public void DSToExcel(string Path,DataSet oldds)
{
//Ïȵõ½»ã×ÜEXCELµÄDataSet Ö÷ҪĿµÄÊÇ»ñµÃEXCELÔÚDataSetÖеĽṹ
string strCon = " Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source ="+path1+";Extended Properties=Excel 8.0" ;
OleDbConnection myConn = new OleDbConnection(strCon) ;
string strCom="select * from [Sheet1$]";
myConn.Open ( ) ;
OleDbDataAdapter myCommand = new OleDbDataAdapter ( strCom, myConn ) ;
ystem.Data.OleDb.OleDbCommandBuilder builder=new OleDbCommandBuilder(myCommand);
//QuotePrefixºÍQuoteSuffixÖ÷ÒªÊǶÔbuilderÉú³ÉInsertCommentÃüÁîʱʹÓá£
builder.QuotePrefix="[";     //»ñÈ¡insertÓï¾äÖб£Áô×Ö·û£¨ÆðʼλÖã©
builder.QuoteSuffix="]"; //»ñÈ¡insertÓï¾äÖб£Áô×Ö·û£¨½áÊøÎ»Öã©
DataSet newds=new DataSet();
myCommand.Fill(newds ,"Table1") ;
for(int i=0;i<oldds.Tables[0].Rows.Count;i++)
{
//ÔÚÕâÀï²»ÄÜʹÓÃImportRow·½·¨½«Ò»Ðе¼Èëµ½newsÖУ¬ÒòΪImportRow½«±£ÁôÔ­À´DataRowµÄËùÓÐÉèÖÃ(DataR


Ïà¹ØÎĵµ£º

ASP.NET MVC postÌá½»±íµ¥ ºǫֵ́Ϊ¿Õ

×òÌìÓöµ½ÁËÒ»¸öСÎÊÌâ,Ìá½»±íµ¥µÄʱºò,ºǫ́µÄactionÖÐÑéÖ¤µÄ±íµ¥ÀïµÄ¿Ø¼þÖµ¾ÓÈ»ÊÇ¿ÕÖµ,µ÷À´µ÷È¥²»µÃÆä·¨.
ÎÒÔÚǰ̨µÄ±íµ¥Àï¿Ø¼þÓõÄÊDZê×¼html¿Ø¼þ
Ò³ÃæÉÏʹÓÃÏÂÃæÓï¾ä·¢ËÍform
<%using (Html.BeginForm("AddNewPicGroups", "MetaData")){ %>
ºǫ́ʹÓÃÈçÏÂÓï¾ä½ÓÊÕʱȴ½ÓÊÕ²»µ½Êý¾Ý
public ActionResult AddNew ......

ASP.NET ºÍ IIS ÅäÖÃ×Ô¶¨ÒåÀ©Õ¹ÃûÍøÒ³

¿´¹ý΢ÈíµÄÍøÕ¾ÓÐʱºò£¬ÊÇ.MSPXµÄÀ©Õ¹Ãû£¿ÆäʵÄãÒ²¿ÉÒÔÅäÖ㬺ܼòµ¥¡£Here We Go!
ÅäÖÃWEB.CONFIG£º
<system.web>
    <compilation>
       <buildProviders>
          <add  ......

[ת]asp.net get setÓ÷¨

     ÔÚÔçÆÚѧϰc#µÄ¹ý³ÌÖУ¬¾­³£Óöµ½ÕâÑùµÄÓï¾ä£º
public string StudentName
{
get{return stuName;}
set{stuName=value;}
}
  
      µ±Ê±Ò²²»ÊǺÜÃ÷°×ΪʲôҪÕâÑù£¿Ñ§ÉîÁËc#ºó£ ......

asp.netÌø×ªÒ³ÃæµÄÈýÖÖ·½·¨±È½Ï

1¡¢ response.redirect Õâ¸öÌø×ªÒ³ÃæµÄ·½·¨Ìø×ªµÄËٶȲ»¿ì£¬ÒòΪËüÒª×ß2¸öÀ´»Ø(2´Îpostback)£¬µ«Ëû¿ÉÒÔÌø תµ½ÈκÎÒ³Ãæ£¬Ã»ÓÐÕ¾µãÒ³ÃæÏÞÖÆ(¼´¿ÉÒÔÓÉÑÅ»¢Ìøµ½ÐÂÀË)£¬Í¬Ê±²»ÄÜÌø¹ýµÇ¼±£»¤¡£µ«ËÙ¶ÈÂýÊÇÆä×î´óȱÏÝ!redirectÌø×ª»úÖÆ£ºÊ×ÏÈÊÇ·¢ËÍÒ»¸öhttpÇëÇ󵽿ͻ§¶Ë£¬Í¨ÖªÐèÒªÌø×ªµ½ÐÂÒ³Ãæ£¬È»ºó¿Í»§¶ËÔÚ·¢ËÍÌø×ªÇëÇóµ½·þÎñÆ÷ ......

ÔÚASP.NETÖÐʹÓÃTreeview¿Ø¼þºÍXML


ÔÚASP.NETÖÐʹÓÃTreeview¿Ø¼þºÍXML
ÒÔǰ£¬ÔÚWEBÒ³ÃæÖÐÈç¹ûÏëʹÓÃÊ÷ÐοؼþµÄ»°£¬ÍùÍù»áÓÐЩÂé·³£¬ÓÐʱÉõÖÁÒª×Ô¼ºÐ´´úÂëÀ´´ïµ½ÓÃÊ÷ÐÎÁбíÏÔʾÊý¾ÝµÄÄ¿µÄ¡£ÔÚasp.netÖУ¬ÎÒÃÇ¿ÉÒԺܷ½±ãµØÊ¹ÓÃÓÉ΢ÈíÌṩµÄInternet Exploer Web Controls¿Ø¼þÀ´ÊµÏÖÊ÷ÐÎÁÐ±í¡£ÔÚ΢ÈíÌṩµÄÕâÌ×Internet Exploere Web Controls¿Ø¼þ¼¯ºÏÖУ¬°üÀ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ