Scripts and example

zhaozj2021-02-16  55

ASP Scripts ¤odbc DSN Connection String: Oconn.open "DSN = mysystemdsn"

¤DSN-Less Connection String for .mdb file: Oconn.Open "provider = microsoft.jet.oledb.4.0; data source =" & Server.mappath (".") & "/Mydb.mdb;user id = admin; Password = "

¤DSN-Less Connection String for Excel Page: Oconn.o "provider = microsoft.jet.OLDB.4.0; Data Source = C: /SOMEPATH/Myspreadsheet.xls; extended proties =" "Excel 8.0; HDR = YES" " 'WHERE "HDR = YES" Means That there is a header row in the cell range ", SO The provider will not include the first row of the' selection Into the recordset. If" hdr = no ", then The Provider Will include 'The First Row of the Cell Range (or Named Ranged) Into The Recordset.

¤DSN-Less Connection String to a Text File: Oconn.Open "provider = microsoft.jet.OLEDb.4.0; data source = c: / somepath /; extended proties =" text; hdr = yes; fmt = Delimited "" "'THEN OPEN A Recordset Based on A Select on the actual fileors.open" Select * from mytextfile.txt ", Oconn, AdopenStatic, AdlockReadOnly, AdcmdText

¤Connection to MS SQL Database: Oconn.open "Provider = SQLOLEDB.1; PERSIST Security Info = FALSE; User ID = UserName; Initial Catalog = Database; Data Source = Quick; Password = password"

¤Connection to mysql database: Oconn.open "provider = msdasql; driver = {mysql odbc 3.51 driver = host; uid = username; pwd = password; data = data; option; / 16387

PHP Scripts ¤DSN Connection String: # Connect to a DSN "MyDB" with a user and password "marin" $ connect = ODBC_CONNECT ("MYDB", "Marin", "Marin"); ¤dsn-less connection string for .mdb : $ Db = adonewconnection ('Access'); $ dsn = "driver = {Microsoft Access Driver (* .mdb)}; dbq = d: /inetpub/adodb/northwind.mdb; uid = admin; pwd =;"; $ DB-> Connect ($ DSN);

¤DSN-Less Connection String for MS SQL Server: $ db = adonewconnection ('odbc_mssql'); $ dsn = "driver = {SQL Server}; server = localhost; database = northwind;"; $ db-> connect ($ DSN , 'userid', 'password');

¤Connection to MySQL: function connect () {mysql_connect ( "IP / SERVER", "USERNAME", "PASSWORD") or die ( "Problem DataBase Connection"); mysql_select_db ( "DATABASENAME") or die ( "Could not select database ");

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

New Post(0)