★33°空間‰


                                 ----★七彩服飾  【最潮拜☆日單精品】【Esprit】【Hotwind】滿150包郵-女裝-流行女裝    www.7color.hb.cn

                                 ----智力比知識重要,素質(zhì)比智力重要,覺悟比素質(zhì)更重要
          posts - 110,comments - 35,trackbacks - 0
          (一)常用連接:
          1.使用SqlConnection對象:
          public void SqlConnectionOpen()
          {
          ?? SqlConnection conn= new SqlConnection();
          ?? conn.ConnectionString = "user id=sa;password=;initial catalog=northwind;datasource=localhost;connect Timeout=20";
          ?? conn.Open();
          }
          2.使用OleDbConnection對象:
          public void OleDBConnectionOpen()
          {
          ?? OleDBConnection conn = new OleDbconnection();
          ?? conn.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;DataSource=C:\Customer.mdb";
          ?? conn.Open();
          }
          (二)其它:
          1.ODBC連接Access本地數(shù)據(jù)庫
          ? conGoodDay.Open("Driver={Microsoft Access Driver(*.mdb)};"+"Dbq=C:\a.mdb;"+
          ? "Uid=Admin;"+"Pwd=;");
          2.ODBC連接Access系統(tǒng)數(shù)據(jù)庫
          ? conGoodDay.Open("Driver={Microsoft Access Driver(*.mdb)};"+"Dbq=C:\a.mdb;"+
          ? "SystemDB=Admin;"+"Pwd=;");
          3.ODBC連接Access系統(tǒng)數(shù)據(jù)庫
          ? conGoodDay.Open("Driver={Microsoft Access Driver(*.mdb)};"+"Dbq=\\server\share\a.mdb;");
          4.ODBC連接Excel系統(tǒng)數(shù)據(jù)庫
          ? conGoodDay.Open("Driver={Microsoft Access Driver(*.xls)};"+"DriverId=790;"+
          ? "Dbq=C:\a.xls;"+"DefaultDir=c:\somepath;");
          5.ODBC連接Oracle系統(tǒng)數(shù)據(jù)庫
          ? conGoodDay.Open("Driver={Microsoft ODBC for Oracle};"+"Server=OracleServer.world;"+
          ? "Uid=Admin;"+"Pwd=password;");
          6.ODBC連接Sql Servr
          ? conGoodDay.Open("Driver={Sql Server};"+"Server=myServer;"+"Database=myDatabaseName;"
          ? "Uid=Admin;"+"Pwd=password;");
          7.ODBC連接Visual FoxPro
          ? conGoodDay.Open("Driver={Microsoft Visual FoxPro Driver};"+
          ? "SourceType=DBC;"+"SourceDB=c:a.dbc;"+"Exclusive=No;");
          posted on 2006-09-20 13:08 圣域飛俠 閱讀(529) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 台南市| 宜春市| 屏东县| 车险| 三原县| 十堰市| 龙海市| 武隆县| 大英县| 田阳县| 雷山县| 蕉岭县| 边坝县| 柏乡县| 吉林省| 西盟| 云安县| 通江县| 莆田市| 曲周县| 泸定县| 平阳县| 岐山县| 五莲县| 泰兴市| 漾濞| 石城县| 独山县| 广昌县| 马关县| 南通市| 株洲县| 张家川| 永康市| 龙山县| 林周县| 壤塘县| 昭觉县| 韶关市| 海南省| 东明县|