ASP.NET¿çÒ³Ãæ´«Öµ¼¼ÇÉ
1. ʹÓÃQueryString±äÁ¿
¡¡¡¡¡¡¡¡QueryStringÊÇÒ»Öַdz£¼òµ¥µÄ´«Öµ·½Ê½£¬Ëû¿ÉÒÔ½«´«Ë͵ÄÖµÏÔʾÔÚä¯ÀÀÆ÷µÄµØÖ·À¸ÖС£Èç¹ûÊÇ´«µÝÒ»¸ö»ò¶à¸ö°²È«ÐÔÒªÇ󲻸߻òÊǽṹ¼òµ¥µÄÊýֵʱ£¬¿ÉÒÔʹÓÃÕâ¸ö·½·¨¡£µ«ÊǶÔÓÚ´«µÝÊý×é»ò¶ÔÏóµÄ»°£¬¾Í²»ÄÜÓÃÕâ¸ö·½·¨ÁË¡£ÏÂÃæÊÇÒ»¸öÀý×Ó£º
a.aspxµÄC#´úÂë
private void Button1_Click(object sender, System.EventArgs e)
{
string s_url;
s_url = "b.aspx?name=" + Label1.Text;
Response.Redirect(s_url);
}
b.aspxÖÐC#´úÂë
private void Page_Load(object sender, EventArgs e)
{
Label2.Text = Request.QueryString["name"];
}
2. ʹÓÃApplication ¶ÔÏó±äÁ¿
¡¡¡¡¡¡¡¡Application¶ÔÏóµÄ×÷Ó÷¶Î§ÊÇÕû¸öÈ«¾Ö£¬Ò²¾ÍÊÇ˵¶ÔËùÓÐÓû§¶¼ÓÐЧ¡£Æä³£Óõķ½·¨ÓÃLockºÍUnLock¡£
a.aspxµÄC#´úÂë
private void Button1_Click(object sender, System.EventArgs e)
{
Application["name"] = Label1.Text;
Server.Transfer("b.aspx");
}
b.aspxÖÐC#´úÂë
private void Page_Load(object sender, EventArgs e)
{
string name;
Application.Lock();
name = Application["name"].ToString();
Application.UnLock();
}
3. ʹÓÃSession±äÁ¿
¡¡¡¡¡¡¡¡Ïë±ØÕâ¸ö¿Ï¶¨ÊÇ´ó¼ÒʹÓÃÖÐ×î³£¼ûµÄÓ÷¨ÁË£¬Æä²Ù×÷ÓëApplicationÀàËÆ£¬×÷ÓÃÓÚÓû§¸öÈË£¬ËùÒÔ£¬¹ýÁ¿µÄ´æ´¢»áµ¼Ö·þÎñÆ÷ÄÚ´æ×ÊÔ´µÄºÄ¾¡¡£
a.aspxµÄC#´úÂë
private void Button1_Click(object sender, System.EventArgs e)
{
Session["name"] = Label.Text;
}
b.aspxÖÐC#´úÂë
private void Page_Load(object sender, EventArgs e)
{
string name;
name = Session["name"].ToString();
}
4. ʹÓÃCookie¶ÔÏó±äÁ¿
¡¡¡¡¡¡¡¡Õâ¸öÒ²ÊÇ´ó¼Ò³£Ê¹Óõķ½·¨£¬ÓëSessionÒ»Ñù£¬ÆäÊÇʲ¶Ôÿһ¸öÓû§¶øÑԵģ¬µ«ÊÇÓиö±¾ÖʵÄÇø±ð£¬¼´CookieÊÇ´æ·ÅÔÚ¿Í»§¶ËµÄ£¬¶øsessionÊÇ´æ·ÅÔÚ·þÎñÆ÷¶ËµÄ¡£¶øÇÒCookieµÄʹÓÃÒªÅäºÏASP.NETÄÚÖöÔÏóRequestÀ´Ê¹Óá£
a.aspxµÄC#´úÂë
private void Button1_Click(object sender, System.EventArgs e)
{
HttpCookie cookie_name
Ïà¹ØÎĵµ£º
ÌõÐÎÂëÊÇÆù½ñΪֹ×á¢ÊµÓõÄÒ»ÖÖ×Ô¶¯Ê¶±ð¼¼Êõ¡£ÌõÐÎÂë¼¼Êõ¾ßÓÐÒÔϼ¸¸ö·½ÃæµÄÓŵã
¡¡¡¡A£®ÊäÈëËٶȿ죺Óë¼üÅÌÊäÈëÏà±È£¬ÌõÐÎÂëÊäÈëµÄËÙ¶ÈÊǼüÅÌÊäÈëµÄ5±¶£¬²¢ÇÒÄÜʵÏÖ“¼´Ê±Êý¾ÝÊäÈ딡£
¡¡¡¡B£®¿É¿¿ÐԸߣº¼üÅÌÊäÈëÊý¾Ý³ö´íÂÊΪÈý°Ù·ÖÖ®Ò»£¬ÀûÓùâѧ×Ö·ûʶ±ð¼¼Êõ³ö´íÂÊΪÍò·ÖÖ®Ò»£¬¶ø²ÉÓÃÌõÐÎÂë¼¼ÊõÎóÂëÂʵ ......
ûÓÐÏëµ½ÕæµÄÕâô·½±ã!¸ü¼Ó¼á¶¨ÎÒѧϰASP.NETµÄ¾öÐÄ! ÏÖÔÚÎÒÃÇÒ»ÆðÀ´¿´¿´°É
1,ÇëÈ·¶¨ÄãµÄµçÄÔ°²×°ÁËÒÔϵÄÈí¼þ£¡
1.1£¬ WINDWOS 2000ÒÔÉÏ°æ±¾(±Ø×°)
1.2£¬ .NET Framework(±Ø×°)
1.3£¬ Visual Studio .NET 2005(±Ø×°)
2,½¨Á¢Ò»¸öACCESSÊý¾Ý¿â,
3,Í϶¯VS2005 µÄGRIDVIEW µ½ ......
ÎÒÃÇ»¹¿ÉÒÔ²ÉÓÃÒ»ÖÖ¸ü¼Ó¼ò±ãµÄ·½
·¨À´ÊµÏÖÉÏÊö³ÌÐòµÄ¹¦ÄÜ¡£Õâ¾ÍÊǽ«SqlConnection¶ÔÏó°üº¬µ½usingÇø¿éÖУ¬ÕâÑù³ÌÐò»á×Ô¶¯µ÷ÓÃDispose()·½·¨ÊÍ·Å
SqlConnection¶ÔÏóËùÕ¼ÓõÄϵͳ×ÊÔ´£¬ÎÞÐèÔÙʹÓÃSqlConnection¶ÔÏóµÄClose()·½·¨¡£
·¶Àý³ÌÐò´úÂëÈçÏ£º
public partial class _Default : System.Web.UI.Page
{
......
ÎļþµÄÉÏ´«ÏÂÔØÊÇÎÒÃÇÔÚʵ¼ÊÏîÄ¿¿ª·¢¹ý³ÌÖо³£ÐèÒªÓõ½µÄ¼¼Êõ£¬ÕâÀï¸ø³ö¼¸ÖÖ³£¼ûµÄ·½·¨£¬±¾ÎÄÖ÷ÒªÄÚÈÝ°üÀ¨£º
¡¡¡¡1¡¢ÈçºÎ½â¾öÎļþÉÏ´«´óСµÄÏÞÖÆ
¡¡¡¡2¡¢ÒÔÎļþÐÎʽ±£´æµ½·þÎñÆ÷
¡¡¡¡3¡¢×ª»»³É¶þ½øÖÆ×Ö½ÚÁ÷±£´æµ½Êý¾Ý¿âÒÔ¼°ÏÂÔØ·½·¨
¡¡¡¡4¡¢ÉÏ´«InternetÉϵÄ×ÊÔ´
¡¡¡¡µÚÒ»²¿·Ö£º
¡¡¡¡Ê×ÏÈÎÒÃÇÀ´ËµÒ»ÏÂÈçºÎ½ ......
b/sģʽÏÂÓóÌÐòʵÏּƻ®ÈÎÎñ£¬Ò»Ö±ÊǸö²»Ì«ºÃ½â¾öºÍ¹ÜÀíµÄÎÊÌ⣬µ±È»¿ÉÒÔ²ÉÓÃajax ¼ÆʱÆ÷µÄ·½·¨Ä£Äâform¶ËµÄtimerʼþ¡£asp.netÏÂʵÏÖ¿ÉÒÔ½«¼Æ»®ÈÎÎñµÄ·½·¨·ÅÔÚglobalÀʹÓÃÒ»¸öͳһµÄÈÎÎñ¹ÜÀíÀàÀ´¹ÜÀí¸÷ÖÖÈÎÎñµÄÖ´ÐУ¬×öµ½²¢Ðв»ã££¡
ÏÂÃæÊÇÎÒдµÄÒ»¸ö·½·¨£¬Ï£ÍûÆð¸öÅ×שÒýÓñµÄ×÷Óã¡´ó¼ÒÒ»ÆðѧϰÏ£º
µÚÒ»²½¶¨ ......