ASP Connection database string Daquan summary page 1/2

Source: Internet
Author: User
Tags dbase

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. (Personal skills are limited. If you have any defects, please let us know .)

<1>. Database Connection method:

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 '"

<2>. Four Common SQL commands:

1. query data records (select)
Syntax: Select field serial from table where field = content
Example: If you want to find all the records whose author is "cancer" from the book table, the SQL statement is as follows:
Select * from book where author = 'cancer'
"*" Is to retrieve all the fields in the book table. If the queried field value is a number, then the "content" after the query does not need to be enclosed by single quotation marks,

If it is a date, it is included in access (#), while in SQL Server,
For example:

Select * from book where id = 1
Select * from book where pub_date = #2002-1-7 # (ACCESS)
Select * from book where pub_date = '2014-1-7 '(SQL Server)

Tip:
The date function to_date is not a standard SQL document and is not applicable to all databases. Therefore, you should refer to the specific database syntax when using it.

Related Article

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.