zoukankan      html  css  js  c++  java
  • 连接字符串

    电子表格:

            string conn = "Provider=Microsoft.jet.OLEDB.4.0;Data Source=" + Server.MapPath("book1.xls") + ";Extended Properties=Excel 8.0;";
            OleDbConnection oleconn = new OleDbConnection(conn);
              OleDbConnection conn = new OleDbConnection("provider=Microsoft.jet.oledb.4.0;data source=d:\\book1.xls;Extended Properties=Excel 8.0");
            OleDbConnection conn = new OleDbConnection("provider=Microsoft.jet.oledb.4.0;data source="+Server.MapPath("book1.xls")+";Extended Properties=Excel 8.0");
      OleDbDataAdapter database = new OleDbDataAdapter("select * from [sheet1$]", oleconn);
      
     
    access数据库:

      conn = new OleDbConnection("Provider=Microsoft.jet.oledb.4.0; Data source=|datadirectory|fileinfo.mdb;jet oledb:database password=mengjiawu;User id=admin");
    string conn = "Provider=Microsoft.jet.OLEDB.4.0;Data Source=" + Server.MapPath("monkey.mdb") + "";
             OleDbConnection oleconn = new OleDbConnection(ConfigurationManager.AppSettings["accessCon"]);
            OleDbConnection conn = new OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=|datadirectory|monkey.mdb");
            OleDbConnection conn = new OleDbConnection("provider=microsoft.jet.oledb.4.0;jet oledb:database password=123;user id=admin;data source=" + Server.MapPath("monkey.mdb"));

    <connectionStrings>
            <add name="connStr" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\Example.mdb" providerName="System.Data.OleDb"/>
    </connectionStrings>

                    conn.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;

       
    sql数据库 
            SqlConnection conn = new SqlConnection("data source=(local);database=monkey;uid=monkey;pwd=donkey");
            SqlDataAdapter database = new SqlDataAdapter("select * from donkey", conn);     
            sdr = cmd.ExecuteReader(CommandBehavior.CloseConnection);    
       server=localhost;database=monkey;uid=monkey;pwd=donkey
    server=monkey;database=newssystem;uid=sa;pwd=c0mPuter

    天道酬勤,厚积薄发。 君子之行,静以修身,俭以养德。 非淡泊无以明志,非宁静无以致远。 如有恒,何须三更起,半夜眠;最怕莫,三天打鱼两天晒网,竹篮打水一场空。
  • 相关阅读:
    一台机器同时启动两个tomcat
    JSP ie8 ie9下标准文档变为杂项模式(Quirks)的解决办法
    mysql备份远程数据库到本地(转载)
    java 读取properties文件
    java中使用MD5进行加密(转)
    Java中继承thread类与实现Runnable接口的区别(转)
    19-background
    18-超链接导航栏案例
    17-文本属性和字体属性
    16-margin的用法
  • 原文地址:https://www.cnblogs.com/houweidong/p/2924642.html
Copyright © 2011-2022 走看看