ASP.NET+MYSQL
MysqlµÄconnector/net5.0ÏÂÔØµØÖ·:
http://dev.mysql.com/get/Downloads/Connector-Net/mysql-connector-net-5.0.6.zip/from/pick
°²×°ºÃÒÔºó,
µãÊôÐÔ,È»ºóµã²éÕÒÄ¿±ê,µãÏòÉÏÒ»²ãĿ¼,ÕÒµ½Binaries\.NET 2.0,È»ºó½«Õâ¸öÎļþ¸´ÖƵ½ÄãµÄ¹¤³ÌĿ¼ÏÂ,Ò»°ãÕâÑùµÄDLLÎļþ»á±£´æµ½binĿ¼ÏÂ.
ÔÚ´úÂëÒ³ÀïÊäÈëusing Mysql.Data.MysqlClient;È»ºóÔÙÔÚPage_Loadº¯ÊýÀïдMysqlConnection£¬ÔÚµ¥´Êдµ½Ò»°ëʱÌáʾ¾Í³öÀ´ÁË£¬ÏÂÃæµÄ¾Í²»ÓÃдÁ˰É?¶¼ÒѾ³öÏÖ”´úÂëÖÇÄÜÍê³ÉÁË”,Ëæ±ãдһ¶Î´úÂëÊÔÊԾͿÉÒÔÁË,ºÍSqlserverÍêÈ«ÏàËÆ.
ÏÂÃæÌṩÁ½¶Î´úÂ빩²Î¿¼,Ò»¸ö´úÂëÒ³,Ò»¸öÊÇHTMLÒ³:
default2.aspx.csϵĴúÂ룺
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MySql.Data.MySqlClient;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string query = "select * from guestbook";
MySqlConnection myConnection = new MySqlConnection("server=localhost;user id=root;password=;database=guestbook");
MySqlCommand myCommand=new MySqlCommand(query,myConnection);
myConnection.Open();
myCommand.ExecuteNonQuery();
MySqlDataReader myDataReader = myCommand.ExecuteReader();
string bookres="";
while (myDataReader.Read()==true)
{
bookres+=myDataReader["id"];
bookres+=myDataReader["user"];
&
Ïà¹ØÎĵµ£º
ÔÚWeb±à³Ì¹ý³ÌÖУ¬´æÔÚןܶలȫÒþ»¼¡£±ÈÈçÔÚÒÔǰµÄASP°æ±¾ÖУ¬CookieΪ·ÃÎÊÕߺͱà³ÌÕß¶¼ÌṩÁË·½±ã£¬²¢Ã»ÓÐÌṩ¼ÓÃܵŦÄÜ¡£´ò¿ªIEä¯ÀÀÆ÷£¬Ñ¡Ôñ“¹¤¾ß”²Ëµ¥ÀïµÄ“InternetÑ¡Ï¬È»ºóÔÚµ¯³öµÄ¶Ô»°¿òÀïµ¥»÷“ÉèÖÔ°´Å¥£¬Ñ¡Ôñ“²é¿´Îļþ”°´Å¥£¬ÔÚµ¯³öµÄ´°¿ÚÖУ¬¾Í»áÏÔʾӲÅÌÀï ......
ͨ¹ý SqlDataSource ¿Ø¼þ£¬¿ÉÒÔʹÓà Web ·þÎñÆ÷¿Ø¼þ·ÃÎÊλÓÚ¹ØÏµÊý¾Ý¿âÖеÄÊý¾Ý¡£ÆäÖпÉÒÔ°üÀ¨ Microsoft SQL Server ºÍ Oracle Êý¾Ý¿âÒÔ¼° OLE DB ºÍ ODBC Êý¾ÝÔ´¡£Äú¿ÉÒÔ½« SqlDataSource ¿Ø¼þÓëÊý¾Ý°ó¶¨¿Ø¼þ£¨Èç GridView¡¢FormView ºÍ DetailsView ¿Ø¼þ£©Ò»ÆðʹÓã¬Óü«ÉÙ´úÂë»òÉõÖÁ² ......
1¡¢ÔÚÒ³Ãæ¶¯Ì¬Ìí¼ÓÒ»¸ö¿Ø¼þµÄ·½·¨¡£ ÔÚÒ³ÃæµÄ HTML ´úÂëÉÏÉèÖÃÒ»¸ö asp:PlaceHolder վλ¿Ø¼þ£¬µ±Ò³Ãæ±»¼ÓÔØµÄʱºò£¬ÔÚÕâ¸ö PlaceHolder ¿Ø¼þÉÏÌí¼ÓËùÐèÒªµÄÆäËû¿Ø¼þ¡£
<asp:PlaceHolder runat="server" id="PutLabelHere" /> Sub Page_Load(sender as Object, e ......
×î½ü×öÒ»¸öÍøÕ¾£¬ÀïÃæÉæ¼°µ½¼¶ÁªµÄÎÊÌ⣨ÈçÊ¡-ÊУ¬Æ·ÅÆ-ÐͺŵÈ), ÎÒÓõÄÊÇDropDownListÀ´ÊµÏֵģ¬ÉèÖø¸¼¶µÄAutoPostBackÊôÐÔÎªÕæ.È»ºóÔÚËüµÄSelectedIndexChanged()ʼþÀïдÏàÓ¦µÄ´úÂ룬ÕâÑù¾ÍÄÜʵÏÖ¼¶Áª¹ØÏµ£¨µ±È»ÕâÀïҪעÒâIsPostBackµÄÎÊÌ⣩. ×öºÃÖ®ºóÓÃʱ·¢ÏÖÒ»¸ö·Ç³£²»Ë¬µÄÎÊÌ⣬ÄǾÍÊÇÿ´Î¶¼»áˢУ¬Õ ......
[ת]asp.netµ¼³öExcel/Csv¸ñʽÊý¾Ý×îÓÅ·½°¸£¨C#£©
±¾ÎÄת×Ô£ºhttp://www.cnblogs.com/lovenets2008/archive/2008/05/06/1184234.html
ÔÎÄÈçÏ£º
ºÃ¾ÃûÓÐдµãʲôÁË£¬Ò²ÐíÊÇ̫æ¡£Ò»ÄêÁË£¬»ýÀÛÁ˲»ÉٺõĶ«¶«£¬Óлú»áʱ¾Íд³öÀ´Óë´ó¼Ò·ÖÏí¡£
ºÃ£¬ÑÔ¹éÕý´«¡£
µ¼³öµ½Excel/CscÎļþ²¢²»ÄÑ£¬ËùÒÔ¾ÍÓкö෽·¨£ ......