Summary of the syntaxes for connecting ASP to 11 Databases

Source: Internet
Author: User
Database operations are frequently used. Including connections Code SQL commands and so on, and never deliberately remember them (I am not willing to remember this stuff), so I often look up books and turn them over when using them. Some of the less-used databases may not be able to be found smoothly, so I will summarize them here for your reference.
1. Access database DSN-less connection method:

Set adocon = server. Createobject ("ADODB. Connection")
Adoconn. Open "driver = {Microsoft Access Driver (*. mdb)}; DBQ =" & _
Server. mappath ("database path")

2. Access ole db connection method:
Set adocon = server. Createobject ("ADODB. Connection")
Adocon. Open "provider = Microsoft. Jet. oledb.4.0;" & _
"Data Source =" & server. mappath ("database path")

3. SQL server connection method:
Set adocon = server. Createobject ("ADODB. recordset")
Adocon. Open "driver = {SQL Server}; server = (local); uid = ***; Pwd = ***;" & _
"Database = database name;"

4. SQL Server OLE DB connection method:
Set adocon = server. Createobject ("ADODB. Connection")
Adocon. Open "provider = sqloledb.1; Data Source = ritant4;" & _
"User id = ***; Password = ***;" & _
"In‑catalog = Database Name"

5. Oracle connection method:
Set adocon = server. Createobject ("ADODB. Connection")
Adocon. Open "driver = {Microsoft ODBC for Oracle}; server = oraclesever. World; uid = admin; Pwd = pass;"

6. Oracle ole db connection method:
Set adocon = server. Createobject ("ADODB. Connection")
Adocon. Open "provider = oraoledb. Oracle; Data Source = dbname; user id = admin; Password = pass;"

7. DBASE connection method:
Set adocon = server. Createobject ("ADODB. Connection")
Adocon. Open "driver = {Microsoft DBASE Driver (*. DBF)}; driverid = 277; DBQ = ------------;"

8. MySQL connection method:
Set adocon = server. Createobject ("ADODB. Connection")
Adocon. Open "driver = {MySQL}; database = yourdatabase;
Uid = username; Pwd = yourpassword; option = 16386;"

9. Visual FoxPro connection method:
Set adocon = server. Createobject ("ADODB. Connection")
Adocon. Open "driver = {Microsoft Visual FoxPro driver}; sourcetype = dBc; sourcedb = *. dBc; exclusive = no;"

10. Ms text connection method:
Set adocon = server. Createobject ("ADODB. Connection")
Adocon. Open "driver = {Microsoft text Driver (*. txt; *. CSV)}; DBQ = -----;" & _
"Extensions = ASC, CSV, tab, txt; persist securityinfo = false;"

11. Ms text ole db connection method:
Set adocon = server. Createobject ("ADODB. Connection")
Adocon. Open "provider = microsof. Jet. oledb.4.0; Data Source = your_path;" & _
"Extended properties 'text; FMt = delimited'"

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.