| Using an ODBC DSN (Data Source Name) is a two step process. 1) You must first create the DSN.
2) Then use the following connection string - with your own DSN
name of course : 01. <%
02. Dim objConn as ADODB.Connection
03. Dim objRS as ADODB.Recordset 04. Dim strConn as String 05. Dim strSQL as String 06. Set objConn = New ADODB.Connection
07. Set objRS = New ADODB.Recordset 08. strConn = "DSN=yourdsnname;Uid=databaseusername;Pwd=password;"
09. objConn.Open strConn 10. strSQL = "Select * from tbAddresses "
11. objRS.Open strSQL, objConn
12. %>
Exaplanation According to Line:
01. Open ASP tag
02. Declare a ADODB.Connection type variable
03. Declare a ADODB.Recordset type variable
04. Declare a String type variable
05. Declare a String type variable
06. Set new instance for ADODB.Connection07. Set new instance for ADODB.Recordset
08. Set connection string into strConn
09. Open connection using strConn
10. Set query statement
11. Query from database
12. Close ASP tag
|
Powered by WHMCompleteSolution