zoukankan      html  css  js  c++  java
  • 数据库连接代码

    1、连接  SQL2000 [sa 身份登录]    string sqlConnection="server=(local);database=db;user id=sa;pwd=123;";

    2、连接  SQL2000 [windows 默认身份登录]    string SqlConnection="server=(local);Initial Catalog=db;Integrated Security=true;";

    3、连接 SQL2005 [sa 身份登录]    string sqlConnection="data source=(local);database=db;user id=sa;pwd=123;"; 4、连接 SQL2005 [windows 默认身份登录]    string SqlConnection="Data Source=(local);Initial Catalog=db;Integrated Security=true;";

    5、连接 Access 数据库    string sqlConnection="Provider=Microsoft.Jet.OleDb.4.0;DataSource="+数据源地址;    string SqlConnection="Provider=Mocrosoft.Jet.OleDb.4.0;DataSource=C:BegAspNetNorthwind.mdb";

    6、连接 Excel 数据源

        (1)连接2003版本的,

    strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pathName + ";Extended Properties='Excel 8.0;HDR=Yes;IMEX=1;'";

        (2)连接2007及2010的,也可以操作2003版本的。功能更强大。

    strConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + pathName + ";Extended Properties='Excel 12.0;HDR=Yes;IMEX=1;'";

    7、连接 Oracle 数据库    string Sqlconnection="Data Source=db;user=system;password=manager;";

  • 相关阅读:
    this指向问题
    b继承a的函数
    如何解决跨域问题
    事件冒泡和阻止事件冒泡
    Spring5(二)——IOC
    MySQL基础(四)——
    MySQL基础(二)——常用命令
    MySQL基础(一)——入门
    Linux(二)——常用命令
    Linux(一)——简介
  • 原文地址:https://www.cnblogs.com/zmm623/p/3209525.html
Copyright © 2011-2022 走看看