Pocket Database Connection Query Manual

zhaozj2021-02-08  279

Pocket Database Connection Query Guide Keywords: Access, SQL Server, Oracle, ASP, ADO Pocket Database Connection Query Manual Preface: National Day, add recently, some netizens do not want to write some experience, I have to put me usually Some of the materials collected by some databases are used to take out some of the information to give everyone a holiday gift. The following information may not be too complete, but can be used to do usual information query, I hope to help everyone, huh, huh. Here will briefly introduce several ADO connection: ODBC DSN, ODBC DSN-LESS, OLE DB Provider, and "MS Remote" Provider.1. ODBC DSN connection i.dsnoconn.open "DSN = Advworks;" & _ "uid = admin;" & _ "PWD =;" Note: You cannot use this way from MDAC2.1, that is, only DSN File Name In ConnectString, you must use the DSN, UID, and PWD flags at the same time. For example, the following manner will be wrong in MDAC 2.1: Oconn.open "II.File DSnoconn.open" filedsn = / somepath / mydb.dsn; "& _" uid =; " Iii.odbc DSN-Less ConnectionsA) odbc text driveroconn.open _ "Driver = {Microsoft text driver (* .txt; * .csv)};" & _ "dbq = / somepath /;" & _ "extensions = ASC, CSV, Tab, Txt; "& _" PERSIST Security Info = FALSE "Note: You need to specify the file name used in the SQL statement.

For example: ors.open "Select * from customer.cs.csv", _oconn, adopenstatic, adlickread, adopenly, adptextb) odbc driver for accessi) Ordinary security mode: Oconn.open _ "driver = {Microsoft Access Driver (* .mdb)};" & _ "DBQ = / somepath / mydb.mdb;" & _ "uid = admin;" & _ "PWD =;" II) If you use System Database: Oconn.open _ "Driver = {Microsoft Access Driver (*. MDB)}; "& _" DBQ = / SomePath / mydb.mdb; "& _" systemdb = / somepath / mydb.mdw; ", _" admin "," c) odbc driver for sql serveri) normal security mode Oconn.open "Driver = {SQL Server};" & _ "Server = carl2;" & _ "Database = PUBS;" & _ "UID = SA;" & _ "PWD =;" II) Use trust security mode: Oconn.open "Driver = {SQL Server};" & _ "Server = carl2;" & _ "Database = PUBS;" & _ "UID =;" & _ "PWD =;" Note: To use blank UID and PWD D) odbc driver for oraclei) Using existing Oracle ODBC Driver from Microsoft: Oconn.open _ "Driver = {Microsoft Odbc for Oracle};" & _ "Server = ORACle Server.World;" & _ "UID = Demo; "& _" PWD = Demo; "II) Using old versions of Oracle ODBC Driver from Microsoft: Oconn.open _" Driver = {Microsoft ODBC Driver for Oracle}; "& _" ConnectString = ORACle Server.World; "& _" Uid = demo; "& _" PWD = DEMO; "IIII) use micro Soft OLE DB DATA LINK Connections Mode Data Link File (UDL) A) Use absolute path Oconn.Open "file name = / somepath / pubs.ud;" b) use relative path Oconn.Open "file name = pubs.ud; "V) OLE DB Provider Connections Method A) OLE DB Provider for ODBC Databasesi) Access (JET): Oconn.open _" Province = msdasql; "& _" Driver =

{Microsoft Access Driver (* .mdb)}; "& _" DBQ = / SomePath / mydb.mdb; "& _" UID = Admin; "& _" PWD =; "II) SQL Server: Oconn.open _" Provider = msdasql; "& _" driver = {SQL Server}; "& _" server = carl2; "& _" Database = PUBS; "& _" UID = SA; "& _" PWD =; "b) OLE DB Provider for Microsoft Jet (Access) i) Ordinary Security Mode: Oconn.open _ "Provider = Microsoft.jet.Oledb.4.0;" & _ "Data Source = / SomePath / MyDb.mdb;" & _ "User ID = Admin; "& _" Password =; "II) If you use System Database: Oconn.Open_" provider = microsoft.jet.Oledb.4.0; "& _" data source = / somepath / mydb.mdb; "& _ "Jet OLEDB: System Database = System.mdw;", _ "admin", "Note: When using OLE DB Provider 4.0 version, you need to convert MDB and MDW files into 4.0 database format III) if MDB needs one Database password: oconn.open _ "provider = microsoft.jet.Oledb.4.0;" & _ "data source = / somepath / mydb.mdb;" & _ "Jet OLEDB: Database Password = mydbpassword;", _ "admin "," c) OLE DB Provider for Excel Spreadsheet: Oconn.open _ "provider = microsoft.jet.oledb.4.0;" & _ "data source = / somepath / expenses.xls;" & _ "extended Properties =" "Excel 8.0; HDR = YES;" ";" Note: "HDR = YES" means that in the first line is a tag, in the provider The first line will not be included in the RECORDSET D) OLE DB Provider for SQL Serveri) Ordinary Safety Mode: Oconn.open "provider = SQLOLEDB;" & _ "Network library = dbmssocn;" & _ "Data Source = carl2;" & _ "Initial catalog = public;" & _ "user ID = sa;" & _ "password =;"

II) Use trust security mode: Oconn.open "provider = sqloledb;" & _network library = dbmsocco; "& _" data source = carl2; "& _" initial catalog = pubs; "& _" trusted_connection = yes; "pay attention : "NetWork Library = DBMSSOCN" Declaration OLE DB Using TCP / IP Replace Named Pipes.e) OLE DB Provider for Oracleoconn.open "provoder = msdaora;" & _ "data source = ORACLERVER.WORLD;" & _ "user ID = SA; "& _" Password =; "(vi) Remote Ole DB Provider Connections mode (that is, I have been studying RDS mode, huh, huh.

转载请注明原文地址:https://www.9cbs.com/read-1795.html

New Post(0)