³éÏ󹤳§Ä£Ê½£ºÊµÏÖASP.NET·ÃÎʲ»Í¬Êý¾Ý¿â
ÔÚASP.NETÍøÕ¾¿ª·¢ÖпÉÄÜ»áÓöµ½Òª¸ü»»Êý¾Ý¿â£¬È罫Aceess»»ÎªSQL Server £¬ÓÉÓÚAceessÒýÓÃSystem.Data.OleDbÃüÃû¿Õ¼ä£¬SQL ServerÒýÓÃSystem.Data.SqlClientÃüÃû¿Õ¼ä¡£ÔÚÒ»°ã³ÌÐò´úÂëÖÐÎÒÃÇÐèÒª¸ü¸ÄÁ¬½Ó×Ö·û´®£¬ADO.NETÊý¾Ý·ÃÎÊÃüÁî¶ÔÏó£¬×îÂé·³µÄÊDz»Í¬Êý¾Ý¿âÓи÷×Ô²»Í¬SqlÃüÁî¡£ÎÒÃÇ¿ÉÒÔʹÓóéÏ󹤳§Ä£Ê½ÊµÏÖASP.NET·ÃÎʲ»Í¬Êý¾Ý¿â¡£
1¡¢³éÏ󹤳§Ä£Ê½£¨Abstract Factory£©£ºÌṩһ¸ö´´½¨Ò»ÏµÁÐÏ໥ÒÀÀµ¶ÔÏóµÄ½Ó¿Ú£¬¶øÎÞÐèÖ¸¶¨ËûÃǵľßÌåÀà¡£
2¡¢Ò»°ã×é³É£º³éÏó²úÆ·½Ó¿Ú£¬¾ßÌå²úÆ·À࣬³éÏ󹤳§½Ó¿Ú£¬¾ßÌ幤³§À࣬¿Í»§¶Ë´úÂë
3¡¢×÷ÓãºÒ×ÓÚ½»»»²úƷϵÁУ¬ÔÚÒ»¸öÓ¦ÓÃÖÐÖ»ÐèÔÚ³õʼ»¯µÄʱºò³öÏÖÒ»´Î£¬Õâ¾ÍʹµÃ¸Ä±äÒ»¸öÓ¦ÓõľßÌ幤³§µÄ¾ßÌ幤³§±äµÃ·Ç³£ÈÝÒ×£¬Ö»Ðè¸Ä±ä¾ßÌ幤³§¼´¿ÉʹÓò»Í¬µÄ²úÆ·ÅäÖÃ
ÈþßÌåµÄ´´½¨ÊµÀý¹ý³ÌÓë¿Í»§¶Ë·ÖÀ룬¿Í»§¶ËÊÇͨ¹ýËûÃǵijéÏóÀà½Ó¿Ú²Ù×ÝʵÀý£¬²úÆ·µÄ¾ßÌåÀàÃûÒ²±»¾ßÌ幤³§ÊÇʵÏÖ·ÖÀ룬²»»á³öÏÖÔÚ¿Í»§´úÂëÖС£
ÍøÉÏÌṩµÄ´úÂë»ù±¾ÊÇΪÁ˽²½â˵Ã÷C#Éè¼Æģʽ£¬ÓÉC#¿ØÖÆ̨³ÌÐò´úÂëʵÏÖ£¬²¢Ã»ÓÐÕæÕýʵÏÖ·ÃÎÊÊý¾Ý¿â¡£ÎÒÕâÀïͨ¹ý½¨Á¢Ò»¸öASP.NETÍøÕ¾£¬ÊµÏÖ·ÃÎÊAccessÓëSQL ServerÊý¾Ý¿â¡£Ö÷Òª²Î¿¼¡¶´ó»°Éè¼Æģʽ¡·
¾ßÌå²½Öè´úÂëÈçÏ£º
1¡¢ ·Ö±ðÔÚAccessºÍSQL Server½¨Á¢Êý¾Ý¿âDaHuaÓëÊý¾Ý¿â±íUser(ID,Name)£¬Department£¨ID,DepartName£©
2¡¢ Æô¶¯Visual Studio 2005/2008н¨ÍøÕ¾
3¡¢ µ½web.configÌí¼ÓÊý¾Ý¿âÁ¬½Ó
4¡¢ ÔÚÍøÕ¾½â¾ö·½°¸ÓÒ¼üн¨Àà¿âClassLibrary1£¬Ð½¨ÀàÎļþ£¬°üÀ¨£º
AbstractUser³éÏóÀ࣬SqlserverUserÀ࣬AccessUserÀà
AbstractDepartment³éÏóÀ࣬SqlserverDepartmentÀ࣬AccessDepartment Àà
DataAccessÀà
Éú³Édll
5¡¢µ½ÏîÄ¿Ìí¼ÓÒýÓã¬ÏîÄ¿-ÓÒ¼ü-Ìí¼ÓÒýÓÃ-ÏîÄ¿-ClassLibrary1
6¡¢Ç°Ì¨´úÂ룺Ìí¼ÓÒ»¸öGridView¿Ø¼þ£¬Èý¸öButton¿Ø¼þ£¬2¸öTextBox¿Ø¼þ
ÓÃÓÚ²éѯ±íUserºÍDepartment±íÄÚÈÝ£¬²åÈëUser±íÊý¾Ý
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Data.OleDb;
using System.Reflection;
namespace ClassLibrary1
{
/// <summary>
///AbstractUser³éÏóÀà
/// </summary>
public abstract clas
Ïà¹ØÎĵµ£º
Ê×Ò³£º
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head ......
1. Asp.NetÖм¸ÖÖÏàËƵıê¼Ç·ûºÅ: < %=...%>< %#... %>< % %>< %@ %>½âÊͼ°Ó÷¨
´ð: < %#... %>: ÊÇÔڰ󶨿ؼþDataBind()·½·¨Ö´ÐÐʱ±»Ö´ÐУ¬ÓÃÓÚÊý¾Ý°ó¶¨
Èç: < %# Container.DataItem("tit") %>
< %= %>: ÔÚ³ÌÐòÖ´ÐÐʱ±»µ÷Ó㬿ÉÒÔÏÔʾºǫ́±äÁ¿Öµ
Èç:
*.aspxÖУº < %= ......
1¡¢Èç¹ûÕâÖÖÇé¿ö³öÏÖÔÚ±¾»ú£¬ÔòÔÚsql server µÄÆóÒµ¹ÜÀíÆ÷µÄ¿ØÖÆ̨Ŀ¼ÀïÑ¡ÔñÏàÓ¦µÄÊý¾Ý¿â£¬ÔÚÆäϵÄÓû§½ÚµãµãÓÒ¼üн¨Êý¾Ý¿âÓû§£¬½«***\ASPNETÓû§¼ÓÈ룬²¢¸³ÓèpublicȨÏÞ¡£
2¡¢Èç¹û³öÏÖÔÚÆäËûµÄµçÄÔ£¬Ôò¼ì²é ³ÌÐòÁ¬½ÓSQLServerµÄÁ¬½Ó×Ö·û´®ÊDz»ÊÇÓÃÁËwindows¼¯³ÉµÇ½£¬Ò»°ã³öÏÖ´ËÎÊÌâµÄ×´¿ö¶¼ÊÇÒòΪʹÓÃÁËwindows¼¯³Éµ ......
ÒÔÏÂÀàÈÝΪתÔØ£¬µ«ÊDz»ÖªµÀÊÇʲôÔÒò£¬¾±¾È˲âÊÔÕâ¸ö·½·¨ÓÐÒ»¸öbug£¬°´ÕÕÒÔÏÂÀàÈÝËùÉè¼ÆµÄ½ÇÉ«ÑéÖ¤²»Äܳɹ¦¡£Application_AuthorizeRequestʼþ¸ÄΪApplication_AuthenticateRequestʼþ²ÅÄÜʵÏÖ¡£
Asp.netµÄÉí·ÝÑéÖ¤ÓÐÓÐÈýÖÖ£¬·Ö±ðÊÇ"Windows | Forms | Passport"£¬ÆäÖÐÓÖÒÔFormsÑéÖ¤ÓõÄ×î¶à£¬Ò²×îÁé»î¡£
Forms ÑéÖ¤ ......
Introduction
In this article, we will take a closer look at how ASP.NET pages post back to themselves, and how to customize this feature in our web applications.
function __doPostBack(eventTarget, eventArgument)
One of the most important features of the ASP.NET environment is the ability to decla ......