Five ways to connect the database in ASP

xiaoxiao2021-03-06  55

Method for the method of five connection databases in the ASP introduces the method of ASP connection SQL, connect Access, and other databases! The first method of five connection databases in the body ASP - this method is used in the most strconn = "driver = Microsoft Access Driver (* .mdb); DBQ =" & Server.mappath ("AspFree.mdb") set in Access Conn = server.createObject ("AdoDb.Connection") Conn.open strconn second - this method is used in SQL Server multiple DIM conn, convetern conta = "driver = {SQL Server}; server = server name; UID = Log in; PWD = login password; database = database name "SET conn = server.createObject (" adodb.connection ") Conn.open Concentol The third strconn =" driver = {MicrosoftAccessDriver (*. Mdb)}; "& _" DBQ = f: /inetpub/wwroot/somedir/db1.mdb; defaultdir = f: / inetpub / wwwroot / somedir; & _ uid = loginid; "& _" pwd = password; driverid = 25; FIL = msaccess; "SET CONN = Server.createObject ("adodb.connection") Conn.open StrConn Sessions Using System Data Source The Following Uses A Data Source Name: SET CONN = Server.createObject ("AdoDb.Connection" Conn.open "Example" fifth With ODBC data sources, the premise is that you must set up data source set RS = Server.createObject ("AdoDb.Recordset") RS.Open "TBLNAME", "DSNNAME", 3, 3 constant value description AdopenForwardonly 0 Starts only a cursor that is forward-only, default AdoPenKeyset 1 launched the keyset type Cursor AdoPENDYNAMIC 2 Start the Dynamic Type Cursor AdoPenStatic 3 Start the Static Type The cursor LockType parameter represents the use of the LOCK type. Constant constant value Description AdlockReadOnly 1 Start in read-only mode, unable to run AddNew, Update, Delete, etc. When the data is being updated, the system does not temporarily lock other users ADLOCKBATCHOPTIMISTIC 4 When the data is being updated, other users must set the CURSORLOCATION property to adusebatch to represent the database operation Options parameter to the type of database request.

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

New Post(0)