¹ØÓÚasp.netµÄÅäÖÃÎļþ
ÅäÖÃÎļþ¿ÉÓÃÀ´´æ·ÅһЩ¶à´ÎÓõ½µÄ³£Á¿Êý¾Ý£¬ÈçÁ¬½Ó´®£º
<appSettings>
<add key="connStr1" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="/>
<add key="connStr2" value="App_Data\test.mdb"/>
</appSettings>
Õâ¸öÅäÖÃÊý¾Ý¿âÁ¬½Ó´®
ʹÓÃʾÀý£º
public class DBConn
{
protected OleDbConnection _conn;
public DBConn(System.Web.UI.Page page)
{
string path = page.Server.MapPath(ConfigurationSettings.AppSettings["connStr2"]);
string connectString = ConfigurationSettings.AppSettings["connStr1"];
connectString += path;
_conn = new OleDbConnection(connectString);
_conn.Open();
}
........
<system.web>
<compilation debug="true" />
Õâ¸öÅäÖÃÍøվΪDEBUGģʽ
<authentication mode="Windows"/>
Õâ¸öÅäÖÃΪWINDWOSÈÏ֤ģʽ¡£
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
Õâ¸öÅäÖÃ403£¬404³ö´íʱµÄ´«»ØÒ³Ãæ
ÅäÖÃÍøÕ¾Óʼþ·þÎñÆ÷£º
<mailSettings>
<smtp from="pclion2008@googlemail.com">
<network host="smpt.gmail.com" userName="" password=""/>
</smtp>
ÖîÈç´ËÀà¡£¶¼ÊÇһЩ³£Á¿²ÎÊý£¬ÒòΪ¶à´ÎÓõ½ÕâЩ²ÎÊý£¬ËùÒÔдÔÚÅäÖÃÎļþÖÐÓÃÆðÀ´¾Í·½±ã¶àÁË¡£ÉõÖÁijЩÁÙʱÊý¾ÝÒ²¿ÉÒÔ´Ó³ÌÐòÖÐдÈ룬ÈÃÁíÒ»ÍøÒ³·ÃÎÊ
Ïà¹ØÎĵµ£º
Data Source=sqlservername;Initial Catalog=dbname;User ID=userid;Password=userpwd
Data Source=(local)\\SQLEXPRESS;Initial Catalog=Êý¾Ý¿âÃû;Integrated Security=True
Data Source=(local);Initial Catalog=Êý¾Ý¿âÃû;User ID=ÕʺÅ;Password=ÕʺÅÃÜÂë
Provider=Microsoft.Jet.OleDb.4.0;Data Source=C:\BegASPNET\ ......
µÚÒ»ÖÖ·½·¨ÊǶÔÒ»¸öaspxÒ³ÃæÉú³ÉhtmlÎļþ£¬ÏȶԷþÎñÆ÷·¢ËÍÇëÇóaspxÒ³Ã棬ȡ·þÎñÆ÷·µ»ØµÄhtmlÁ÷£¬Ð´µ½Ò»¸öhtmlÎļþÀaspxÒ³ÃæÏÔʾµÄÊÇʲô£¬Éú³ÉµÄhtmlÒ³Ãæ¾ÍÊÇʲô
£±¡¢asp·½·¨£º
sub createHTML
dim xmlhttp,strhtml,objAdoStream,i,myurl
set xmlhttp=server.CreateObject("Microsoft.XMLHTTP")
&nb ......
ÓÃDataBinder.eval °ó¶¨Êý¾Ý²»±Ø¹ØÐÄÊý¾ÝÀ´Ô´(Dataread»òdataset)Ò²²»±Ø¹ØÐÄÊý¾ÝµÄÀàÐÍ,eval»á°ÑÕâ¸öÊý¾Ý¶ÔÏóת»»ÎªÒ»¸ö×Ö·û´®¡£Êǵײã°ó¶¨×öÁ˺ܶ๤×÷£¬Ê¹ÓÃÁË·´ÉäÐÔÄÜ¡£ÕýÒòΪʹÓ÷½±ãÁË£¬µ«È´Ó°ÏìÁËÊý¾ÝÐÔÄÜ¡£µ±Óëdataset°ó¶¨Ê±£¬DataItemÆäʵÊÇÒ»¸öDataRowView£¨Èç¹û°ó¶¨µÄÊÇÒ»¸öÊý¾Ý¶ÁÈ¡Æ÷£¨dataread£©Ëü¾ÍÊÇÒ»¸öIdat ......
¡¡1. Êý¾Ý¿â·ÃÎÊÐÔÄÜÓÅ»¯
¡¡¡¡Êý¾Ý¿âµÄÁ¬½ÓºÍ¹Ø±Õ
¡¡¡¡·ÃÎÊÊý¾Ý¿â×ÊÔ´ÐèÒª´´½¨Á¬½Ó¡¢´ò¿ªÁ¬½ÓºÍ¹Ø±ÕÁ¬½Ó¼¸¸ö²Ù×÷¡£ÕâЩ¹ý³ÌÐèÒª¶à´ÎÓëÊý¾Ý¿â½»»»ÐÅÏ¢ÒÔͨ¹ýÉí·ÝÑéÖ¤£¬±È½ÏºÄ·Ñ·þÎñÆ÷×ÊÔ´¡£ASP.NETÖÐÌṩÁËÁ¬½Ó³Ø(Connection Pool)¸ÄÉÆ´ò¿ªºÍ¹Ø±ÕÊý¾Ý¿â¶ÔÐÔÄܵÄÓ°Ï졣ϵͳ½«Óû§µÄÊý¾Ý¿âÁ¬½Ó·ÅÔÚÁ¬½Ó³ØÖУ¬ÐèҪʱȡ³ö£¬¹Ø± ......
Default.aspx:
<%@ 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" & ......