Five ways to connect the database in ASP

xiaoxiao2021-03-06  42

The first method of five connection databases in ASP - this method is used in acconn = "driver = Microsoft Access Driver (* .mdb); DBQ =" & Server.mappath ("aspfree.mdb") set conn = Server.createObject ("adodb.connection") Conn.open strconn second - this method is used in SQL Server multiple DIM CONN, CONNTOL Concentol = "Driver = {SQL Server}; server = server name; UID = landing Account; PWD = login password; database = database name "SET conn = server.createObject (" adodb.connection ") Conn.open Concent = Server.createObject (" Adodb.Connection ") conn.open "PROVIDER = SQLOLEDB; DATA SOURCE = IP; UID = account; PWD = password; DATABASE = hcgood" third strconn = "Driver = {MicrosoftAccessDriver (* mdb.)};" & _ "DBQ = F: Inetpubwwwrootsomedirdb1 .mdb; DefaultDir = f: Inetpubwwwrootsomedir; & _ uid = LoginID; "& _" pwd = Password; DriverId = 25; FIL = MSAccess; "set conn = server.createobject (" adodb.connection ") conn.open strconn fourth Application System Data Source The Following Uses A Data Source Name: SET CONN = Server.createObject ("AdoDb.Connection" Conn.open "Example" fifth use ODBC data source, provided that you must set up in the ODBC of the control panel Data Source Set RS = Server.create Object ("AdoDb.Recordset") RS.Open "TBLNAME", "DSNNAME", 3, 3 constant constant value indicates that AdoPenForwardonly 0 starts only the cursor of forward-only, the default value AdoPenKeyset 1 start KeySet Type Cursor AdoPENDYNAMIC 2 Start the Dynamic Type cursor AdoPenStatic 3 Start the Static type cursor LockType parameter indicates the use of the LOCK type.

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

New Post(0)