ASP and SQL database connection code!

zhaozj2021-02-16  63

ASP and SQL database connection code! // First Writing: mm_conn_string = "driver = {SQL Server}; server = (local); UID = SA; PWD =; Database = INFS;" SET CONN = Server.createObject ("AdoDb.Connection" conn. Open mm_conn_stringset = server.createObject ("adoBd.recordset") SQL = "Select * from table order by id" rs.open SQL, CONN, 3, 3

// Second Writing: (DSN connection)

MM_conn_STRING = "DSN = BBS; UID = SA; PWD = 12345" Set conn = Server.Createobject ( "ADODB.Connection") conn.open MM_conn_STRINGSET RS = SERVER.CreateObject ( "ADOBD.recordset") SQL = "SELECT * FROM Table ORDER BY ID DESC "RS.Open SQL, CONN, 3, 3 // 3, 3 is modified, deleted, add switch!

// Third way of writing:

MM_CONN_STRING_OWN = "Driver = {SQL Server}; server = (local); UID = SA; PWD = 11111; Database = INFS;" SET CONN = Server.createObject ("AdoDb.Connection" Conn.open mm_conn_string_oewn

// The fourth - this method is used in acconn = "driver = microsoft access driver (* .mdb); dbq =" _ & server.mappath ("asp.mdb") set conn = server.createObject ("AdoDB .connection ") Conn.open Strconn

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

New Post(0)