五种DSN的使用方法

王朝asp·作者佚名  2006-01-08
窄屏简体版  字體: |||超大  

五种DSN的使用方法

第一种 - 这种方法用在ACCESS中最多

strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("aspfree.mdb")

set conn = server.createobject("adodb.connection")

conn.open strconn

第二种-这种方法用在SQL SERVER中多

strconn = "Driver={SQL Server};Description=sqldemo;SERVER=127.0.0.1;UID=LoginID;PWD=Password;DATABASE=Database_Name

set conn = server.createobject("adodb.connection")

conn.open strconn

第三种

strconn="Driver={MicrosoftAccessDriver(*.mdb)};DBQ=F:\Inetpub\wwwroot\somedir\db1.mdb;DefaultDir=f:\Inetpub\wwwroot\somedir;uid=LoginID;pwd=Password;DriverId=25;FIL=MSAccess;" set conn = server.createobject("adodb.connection")

conn.open strconn

第四种运用系统数据源

The following uses a Data Source Name:

set conn = server.createobject("adodb.connection")

conn.open "Example"

'This is created in the Control Panel using the 32 bit ODBC Driver. If you don't know how to setup here is a perfect example on ActiveServerPages.com (click here to find how to create System and File DSN's!

第五种运用ODBC数据源,前提是你必须在控制面板的ODBC中设置数据源

set rs = server.createobject("adodb.recordset")

rs.open "tblname", "DSNName", 3, 3

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航