ASP database connection

xiaoxiao2021-03-05  23

MS Access database connection with DSN connection and no username and password: <% set conn = server.createObject ("AdoDb.Connection") Conn.open "YourDsnname"%> Connect with DSN and has a username and password: <% set conn = Server.createObject ("AdoDb.Connection" Conn.open "YourDsnname", "UserName", "Password"%> With the actual database absolute path connection: <% set conn = server.createObject ("AdoDb.Connection" StrConn = "Driver = {Microsoft Access Driver (* .mdb)};" StrConn = StrConn & "DBQ = E: /Yanhang/Database.mdb" Conn StrConn%> With the actual database relative path connection: <% set conn = Server.createObject ("adoDb.connection") strconn = "driver = {Microsoft Access driver (* .mdb)};" strconn = strconn & "dbq =" & server.mappath ("/ database / yanhang.mdb") Conn.open strconn%> MS SQL Server database connection DSN connection: <% set conn = server.createObject ("adoDb.connection") conn.open "DSN = MyDSN; UID = USER; PWD = Password; Database = dataBasename" %> No DSN connection: <% set conn = server.createObject ("adoDb.connection") dsntemp = "driver = {SQL Server}; server = servername; uid = user; pwd = password; database = databasename" conn.open DSNTemp%> FoxPro database connection <% set conn = server.createObject ("adoDb.connection" connStr = "DR Iver = Microsoft Visual FoxPro Driver; UID = UserId; SourceType = DBC; SourceDb = C: /Yanhang/Database.dbc "Conn.open ConnStr%> Oracle Database Connection: <% SET CONN = Server.createObject (" AdoDb.Connection " ) conn.cursorlocation = aduseclientdsntemp = "provider = msdaora.1; password = xxxxx; user ID = yanhang; data source = xxx.world" conn.open dsntemp%>

This is MS SQL.

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

New Post(0)