熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> SQL Server >> 正文

一個典型的SQL Server數據庫連接范例

2022-06-13   來源: SQL Server 

  OLE DB Method for SQL
  <%
  set cnn = servercreateobject(ADODBConnection)
  cnnopen PROVIDER=SQLOLEDB;DATA SOURCE=sqlservername;UID=username;PWD=password;DATABASE=databasename
  %>
  
  DSN Less connection for Access
  <%
  set cnn = servercreateobject(ADODBConnection)
  cnnopen DRIVER={Microsoft Access Driver (*mdb)};DBQ=c:\anydatabasemdb
  %>
  
  OLE DB Method for Access
  <%
  set cnn = servercreateobject(ADODBConnection)
  cnnopen PROVIDER=MICROSOFTJETOLEDB;DATA SOURCE=c:\anydatabasemdb
  %>
  
  File DSN Connection Method for Access
  <% set cnn = servercreateobject(ADODBConnection)
  cnnopen FILEDSN=AccessDSN
  %>
From:http://tw.wingwit.com/Article/program/SQLServer/201311/22033.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.