• 在web.config中连接各种数据库代码


    1<?xml version="1.0"?>
     2<configuration>
     3 <connectionStrings>
     4    <!--
     5    This connection is inherited from the ASP.NET Quickstart Web.config file
     6    Uncomment this section to edit the sample locally
     7

     8    <add name="Pubs" connectionString="Server=(local)\SQLExpress;Integrated Security=True;Database=pubs;Persist Security Info=True"
     9      providerName="System.Data.SqlClient" />


    10    <add name="Northwind" connectionString="Server=(local)\SQLExpress;Integrated Security=True;Database=Northwind;Persist Security Info=True"
    11      providerName="System.Data.SqlClient" />

    12    <add name="Contacts" connectionString="Server=(local)\SQLExpress;Integrated Security=True;Database=Contacts;Persist Security Info=True"
    13     providerName="System.Data.SqlClient" />
    14    -->
    15

        <add name="NorthwindOLEDB" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|Northwind.mdb;"
    16     providerName="System.Data.OleDb" />
    17

        <add name="ContactsDatabase" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|Database.mdf;Integrated Security=True;User Instance=true;"
    18     providerName="System.Data.SqlClient" />

    19 </connectionStrings>
    20    <system.web>
    21        <pages styleSheetTheme="Default"/>
    22        <caching>
    23            <sqlCacheDependency enabled="true" pollTime="1000">
    24                <databases>
    25                    <add name="Pubs" connectionStringName="Pubs"/>
    26                </databases>
    27            </sqlCacheDependency>
    28        </caching>
    29        </system.web>
    30</configuration>
    31
  • 相关阅读:
    织梦CMS去广告方法 for DedeCMS V5.7
    织梦网站底部的Power by DedeCms怎么去掉?
    java环境变量最佳配置
    HTML课上小结
    PHP四个阶段目标以及第一阶段学习内容
    例子:选项卡和进度条
    例子:轮播效果
    例子:下拉列表
    document对象操作:浏览器页面文件
    Windows对象操作:浏览器窗口信息
  • 原文地址:https://www.cnblogs.com/huashanlin/p/474279.html
Copyright © 2020-2023  润新知