Methods for connecting DBF, DBC, MDB, Excel, SQL Server databases with asp:
ASP Object Access database method
In ASP, the object that accesses a database is called ADO (Active Data Objects), contains three kinds of objects mainly: Connection, Recordset, Command
Connection: Responsible for opening or connecting data
Recordset: Responsible for accessing data tables
Command: Responsible for performing action query commands on the database
Two, the connection each database driver
You can use a driver or a data source to connect to each database, but I recommend that you use a driver because it's easy and easy to use, and it's cumbersome to use a data source.
ODBC links
Ways to link database types
Access "Driver={microsoft access Driver (*.mdb)};d bq=*.mdb;uid=admin;pwd=pass;"
DBase "Driver={microsoft dBase Driver (*.dbf)};d riverid=277;dbq=------------;"
Oracle "Driver={microsoft ODBC for Oracle};server=oraclesever.world;uid=admin;pwd=pass;"
MSSQL server "Driver={sql server};server=servername;database=dbname;uid=sa;pwd=pass;"
MS text "Driver={microsoft text Driver (*.txt; *.csv)};d bq=-----; extensions=asc,csv,tab,txt; Persist Securityinfo=false; "
Visual Foxpro "Driver={microsoft visual Foxpro Driver};sourcetype=dbc;sourcedb=*.dbc; Exclusive=no; "
MySQL "Driver={mysql};d atabase=yourdatabase;uid=username;pwd=yourpassword;option=16386;"
OLE DB Links
The appropriate way to link database types
Access "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=your_database_path;user id=admin;password=pass;"
Oracle "Provider=oraoledb.oracle;data source=dbname;user id=admin;password=pass;"
MS SQL Server "Provider=sqloledb;data source=machinename;initial catalog=dbname;userid=sa;password=pass;"
MS text "Provider=microsof.jet.oledb.4.0;data Source=your_path; Extended Properties ' text; Fmt=delimited ' "
And we generally use Access database more, here I recommend that you connect to an Access database using the following methods:
Dim conn
Set conn = Server.CreateObject ("Adodb.connection")
Conn.Open = "Provider=Microsoft.Jet.OLEDB.4.0" & "Data Source =" & Server.MapPath (". /db/bbs.mdb ")
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.