Home > Web Front-end > JS Tutorial > 11 ASP methods to connect to the database_javascript skills

11 ASP methods to connect to the database_javascript skills

WBOY
Release: 2016-05-16 15:38:49
Original
2459 people have browsed it

11 ways to use ASP to connect to databases - This article summarizes the methods of using ASP to connect to various databases:
1. DSN-less connection method for Access database:

set adocon=Server.Createobject("adodb.connection")
adoconn.Open"Driver={Microsoft Access Driver(*.mdb)};DBQ="& _
Server.MapPath("数据库所在路径")
Copy after login


2. Access OLE DB connection method:

set adocon=Server.Createobject("adodb.connection")
adocon.open"Provider=Microsoft.Jet.OLEDB.4.0;"& _
"Data Source=" & Server.MapPath("数据库所在路径")
Copy after login

3. SQL server connection method:

set adocon=server.createobject("adodb.recordset")
adocon.Open"Driver={SQL Server};Server=(Local);UID=***;PWD=***;"& _
"database=数据库名;"
Copy after login

4.SQL server OLE DB connection method:

set adocon=Server.Createobject("adodb.connection")
adocon.open"provider=SQLOLEDB.1;Data Source=RITANT4;"& _
"user ID=***;Password=***;"& _
"inital Catalog=数据库名"
Copy after login

5.Oracle connection method:

set adocon=Server.Createobject("adodb.connection")
adocon.open"Driver={microsoft odbc for oracle};server=oraclesever.world;uid=admin;pwd=pass;"
Copy after login


6.Oracle OLE DB 连接方法:

set adocon=Server.Createobject("adodb.connection")
adocon.open"Provider=OraOLEDB.Oracle;data source=dbname;user id=admin;password=pass;"
Copy after login

7.dBase 连接方法:

set adocon=Server.Createobject("adodb.connection")
adocon.open"Driver={microsoft dbase driver(*.dbf)};driverid=277;dbq=------------;"
Copy after login


8.mySQL 连接方法:

set adocon=Server.Createobject("adodb.connection")
adocon.open"Driver={mysql};database=yourdatabase;
uid=username;pwd=yourpassword;option=16386;"
Copy after login


9.Visual Foxpro 连接方法:

set adocon=Server.Createobject("adodb.connection")
adocon.open"Driver={microsoft Visual Foxpro driver};sourcetype=DBC;sourceDB=*.dbc;Exclusive=No;"
Copy after login


10.MS text 连接方法:

set adocon=Server.Createobject("adodb.connection")
adocon.open"Driver={microsoft text driver(*.txt; *.csv)};dbq=-----;"&_
"extensions=asc,csv,tab,txt;Persist SecurityInfo=false;"
Copy after login


11.MS text OLE DB 连接方法:

set adocon=Server.Createobject("adodb.connection")
adocon.open"Provider=microsof.jet.oledb.4.0;data source=your_path;"&_
"Extended Properties'text;FMT=Delimited'"
Copy after login

以上就是11种ASP连接数据库的方法,希望对大家的学习有所帮助。

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template