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